Go SDK
GreptimeDB Go SDK 使用 gRPC 与数据库通信, 请参考 Go SDK 文档查看更多 SDK 使用的相关内容。
请使用以下信息连接到 GreptimeCloud:
- Host:
<host> - Port:
4001 - Database:
<dbname> - Username:
<username> - Password: Your GreptimeCloud service password
下方的代码片段展示了如何使用 Go SDK 建立一个 client 连接对象:
go
1. options := []grpc.DialOption{
2. grpc.WithTransportCredentials(insecure.NewCredentials()),
3. }
5. cfg := greptime.NewCfg("<host>").
6. WithDatabase("<dbname>").
7. WithPort(4001).
8. WithAuth("<username>", "*Your GreptimeCloud service password*").
9. WithDialOptions(options...). // specify your gRPC dail options
10. WithCallOptions() // specify your gRPC call options
12. client, err := greptime.NewClient(cfg)
13. if err != nil {
14. panic("failed to init client")
15. }
