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:
4001
- Database:
<dbname>
- Username:
<username>
- Password:
<password>
The following code shows how to create a client
.
go
options := []grpc.DialOption{
grpc.WithTransportCredentials(insecure.NewCredentials()),
}
cfg := greptime.NewCfg("<host>").
WithDatabase("<dbname>").
WithPort(4001). // default port
WithAuth("<username>", "<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")
}
当前内容版权归 GreptimeDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 GreptimeDB .