init.go 351 B

12345678910111213141516171819202122
  1. package influxdb
  2. import (
  3. iclient "github.com/influxdata/influxdb/client/v2"
  4. )
  5. var InfluxCli iclient.Client
  6. func Setup(addr, username, password string) error {
  7. cli, err := iclient.NewHTTPClient(iclient.HTTPConfig{
  8. Addr: addr,
  9. Username: username,
  10. Password: password,
  11. })
  12. if err != nil {
  13. return err
  14. }
  15. InfluxCli = cli
  16. return nil
  17. }