You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.0 KiB
Go

package influxdb
import (
"errors"
_ "fmt"
_ "github.com/influxdata/influxdb-client-go/v2"
)
type DBClient struct {
URL string
Org string
Bucket string
Token string
// Client *influxdb2.Client
}
type DBAdmin struct {
// struct for admin methods
*DBClient
}
func NewDBClient(url, org, token string) *DBClient {
db := &DBClient{URL: url, Org: org, Token: token}
return db
}
func NewDBAdmin(url, org, token string) *DBAdmin {
admin := &DBAdmin{}
admin.DBClient = NewDBClient(url, org, token)
return admin
}
// base level funcs
func (d *DBClient) Start() {
// connect to DB
}
func (d *DBAdmin) GetReactorClient(id string) (string, string, error) {
// given an id returns associated token and bucket
/*
client := influxdb2.NewClient(d.URL, d.Token)
defer client.Close()
bucket, err := client.BucketsAPI().FindBucketByName(context.Background(), id)
if err != nil {
return "", "", err
}
if d.ReactorExists(id) {
// get corresponding reactor token and bucket
}
*/
return "", "", errors.New("Unimpl")
}