This topic describes how to use Tablestore SDK for Go to list the names of data tables in an instance.
Prerequisites
A client is initialized. For more information, see Initialize a Tablestore client.
Method description
func (tableStoreClient *TableStoreClient) ListTable() (*ListTableResponse, error)Sample code
The following sample code demonstrates how to query the list of data tables in an instance and print the table names.
func ListTableSample(client *tablestore.TableStoreClient){
tables, err := client.ListTable()
if err != nil {
fmt.Println("Failed to list table with error:", err)
} else {
for _, table := range (tables.TableNames) {
fmt.Println(table)
}
}
}References
For more information, see Query the names of time series tables.