You can call the ListTable operation to query the names of all tables that are created in the current instance.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. For more information, see Create a data table.
API operation
// List all tables. If the operation is successful, the names of all tables are returned.
ListTable() (*ListTableResponse, error)
Examples
The following sample code provides an example on how to query the names of all tables in an instance:
func ListTableSample(client *tablestore.TableStoreClient){
tables, err := client.ListTable()
if err != nil {
fmt.Println("Failed to list table")
} else {
fmt.Println("List table result is")
for _, table := range (tables.TableNames) {
fmt.Println("TableName: ", table)
}
}
}
References
For information about the API operation that you can call to query the names of tables, see ListTable. For the detailed sample code, visit ListTable@GitHub.
You can update a table to modify the information about the table, such as the time to live (TTL) and max versions. For more information, see Update a table.
You can call API operations to read and write data in a data table. For more information, see Basic operations on data.
You can query the description of a table to view the configuration information about a table, such as the max versions and TTL. For more information, see Query the description of a table.
You can delete a data table that you no longer require. For more information, see Delete tables.