Skip to content
On this page



go get

Create a Client

package example

import (
    greptime ""

func InitClient() *greptime.Client {
    options := []grpc.DialOption{
    // To connect a database that needs authentication, for example, those on Greptime Cloud,
    // `Username` and `Password` are needed when connecting to a database that requires authentication.
    // Leave the two fields empty if connecting a database without authentication.
    cfg := greptime.NewCfg("").
        WithDatabase("public").      // change to your real database
        WithPort(4001).              // default port
        WithAuth("", "").            // `Username` and `Password`
        WithDialOptions(options...). // specify your gRPC dail options
        WithCallOptions()            // specify your gRPC call options

    client, err := greptime.NewClient(cfg)
    if err != nil {
        panic("failed to init client")
    return client

See Go SDK in reference to get more configurations.

Write Data

Please refer to write data.

Query Data

Please refer to Query data.