0

I want to use Golang API to write data to Influxdb, but if a database does not exist, it cannot be written.

So, how should I use the InfluxDB1.8 Golang API to determine whether the database exists?

If it does not exist, how can I use the API to create a database?

張三瘋
  • 1
  • 2
  • Database creation has its own example in the docs: https://pkg.go.dev/github.com/influxdata/influxdb@v1.9.2/client/v2#example-Client-CreateDatabase – Adrian Jun 29 '21 at 14:07
  • To check if a DB exists, run a `SHOW DATABASES` query: https://docs.influxdata.com/influxdb/v1.8/query_language/explore-schema/#show-databases – Adrian Jun 29 '21 at 14:09

0 Answers0