forked from aliyun/aliyun-tablestore-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.go
35 lines (31 loc) · 1.1 KB
/
sample.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"./sample"
"os"
"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore"
)
func main() {
// Replace the endpoint info
endpoint := os.Getenv("TS_TEST_ENDPOINT")
instanceName := os.Getenv("TS_TEST_INSTANCENAME")
accessKeyId := os.Getenv("TS_TEST_KEYID")
accessKeySecret := os.Getenv("TS_TEST_SECRET")
client := tablestore.NewClient(endpoint, instanceName, accessKeyId, accessKeySecret)
// Table operation
sample.CreateTableSample(client, "sampletable")
sample.CreateTableKeyAutoIncrementSample(client)
sample.DeleteTableSample(client)
sample.ListTableSample(client)
sample.UpdateTableSample(client, "sampletable")
sample.DescribeTableSample(client, "sampletable")
// Single row operation
sample.PutRowSample(client,"sampletable")
sample.UpdateRowSample(client, "sampletable")
sample.GetRowSample(client, "sampletable")
sample.DeleteRowSample(client, "sampletable")
sample.PutRowWithKeyAutoIncrementSample(client)
// Multi row operation
sample.BatchWriteRowSample(client,"sampletable")
sample.BatchGetRowSample(client, "sampletable")
sample.GetRangeSample(client, "sampletable")
}