使用 Tablestore Go SDK 列出指定資料表的多元索引。
前提條件
安裝Tablestore Go SDK並初始化用戶端。
功能說明
調用 ListSearchIndex 方法擷取指定資料表下的多元索引名稱。
func (client *tablestore.TableStoreClient) ListSearchIndex(request *tablestore.ListSearchIndexRequest) (*tablestore.ListSearchIndexResponse, error)response, err := client.ListSearchIndex(&tablestore.ListSearchIndexRequest{
TableName: "example_table",
})
if err != nil {
log.Fatal(err)
}
for _, index := range response.IndexInfo {
fmt.Println(index.TableName, index.IndexName)
}參數說明
名稱 | 類型 | 說明 |
TableName(必選) | string | 資料表名稱。 |
傳回值
名稱 | 類型 | 說明 |
IndexInfo | []*tablestore.IndexInfo | 多元索引列表。 |
IndexInfo[].TableName | string | 資料表名稱。 |
IndexInfo[].IndexName | string | 多元索引名稱。 |