Go SDK

The GreptimeDB Go ingester library utilizes gRPC for writing data to the database. For how to use the library, please refer to the Go library documentation.

To connect to GreptimeCloud, using information below:

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

The following code shows how to create a client.

  1. cfg := greptime.NewConfig("<host>").
  2. WithDatabase("<dbname>").
  3. WithPort(5001).
  4. WithInsecure(false).
  5. WithAuth("<username>", "<password>")
  6. cli, err := greptime.NewClient(cfg)
  7. if err != nil {
  8. panic("failed to init client")
  9. }