The Tablestore client provides a series of methods to manage tables and perform read and write operations on a single row or multiple rows.

Obtain an endpoint

An endpoint is the domain name that is used to access a Tablestore instance in a region. To query an endpoint, perform the following operations:

  1. Log on to the Tablestore console.
  2. Go to the Instance Details tab. You can view the endpoints of the instance in the Instance Access URL section.
Note For more information about the endpoints, see Endpoint.

Configure an AccessKey pair

To access Tablestore, you must have an AccessKey pair that consists of an AccessKey ID and AccessKey secret to verify your identity. For more information, see Create an AccessKey. After you obtain the AccessKey pair, you can initialize an OTSClient instance.

Use the endpoint of a Tablestore instance to create a client.

  • Operation
        // Initialize the TableStoreClient instance.
        // endPoint indicates the endpoint used to access the Tablestore instance, which must start with https://. Example: 'https://instance.region.ots.example.com:80.
        // accessKeyId indicates the AccessKey ID used to access the Tablestore instance. You can visit the official website or contact an administrator to obtain an AccessKey ID.
        // accessKeySecret indicates the AccessKey secret used to access the Tablestore instance. You can visit the official website or contact an administrator to obtain an AccessKey secret.
        // instanceName indicates the name of the instance to access. You can create an instance in the Tablestore console or contact an administrator to obtain the name of an existing instance.
    func NewClient(endPoint, instanceName, accessKeyId, accessKeySecret string, options ...ClientOption) *TableStoreClient
    					
  • Examples
        client = NewClient("your_instance_endpoint",  "your_instance_name", "your_user_id", "your_user_key")