Go Client Library for Reckoner CDP services.
With this gem, you can:
- stream your data to Reckoner CDP databases.
- run query.
$ go get github.com/3-shake/reckoner-cdp-go
Initialize a client to your reckoner cdp database:
import "github.com/3-shake/reckoner-cdp-go"
client := reckonercdp.NewClient(&reckonercdp.ClientSettings{
AccessKeyID: "yourAccessKeyID",
SecretAccessKey: "yourSecretAccessKey",
})
You can get your Access Key ID
and Secret Access Key
from
Management
page on WEB UI.
Stream Struct:
type Item struct {
Bar string
Foo string
}
item := &Item{
Bar: "bar",
Foo: "foo",
}
if err := client.Insert("database_name", "table_name", item); err != nil {
fmt.Println(err)
}
Stream Slice:
type Item struct {
Bar string
Foo string
}
items := []interface{}{
&Item{
Bar: "bar1",
Foo: "foo1",
},
&Item{
Bar: "bar2",
Foo: "foo2",
},
}
if err := client.BulkInsert("database_name", "table_name", items); err != nil {
fmt.Println(err)
}
Before streaming your data to reckoenr CDP, you need to create database and table which you stream your data to on reckoner CDP. you can create database and table from WEB UI.
res, err := client.Query("SELECT * FROM `team.database_name`.`table_name` LIMIT 1")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res.Records)