Go SDK

GreptimeDB Go SDK 使用 gRPC 与数据库通信, 请参考 Go SDK 文档查看更多 SDK 使用的相关内容。

请使用以下信息连接到 GreptimeCloud:

  • Host: <host>
  • Port: 5001
  • Database: <dbname>
  • Username: <username>
  • Password: <password>

下方的代码片段展示了如何使用 Go SDK 建立一个 client 连接对象:

1. cfg := greptime.NewConfig("<host>").
2. WithDatabase("<dbname>").
3. WithPort(5001).
4. WithInsecure(false).
5. WithAuth("<username>", "<password>")

7. cli, err := greptime.NewClient(cfg)
8. if err != nil {
9. panic("failed to init client")
10. }