influxdata / influxdb-client-go

InfluxDB 2 Go Client
MIT License
606 stars 117 forks source link

Flux DSL librairy for Go #343

Open jjauzion opened 2 years ago

jjauzion commented 2 years ago

Proposal: It would be really nice to have a Flux DSL librairy for the go client; similarly to what exist for the Java client

Current behavior: With the current librairy I have to write the query as a string:

result, err := queryAPI.Query(context.Background(), `from(bucket:"my-bucket")|> range(start: -1h) |> filter(fn: (r) => r._measurement == "stat")`)

Desired behavior: It would be much better if I could chain operator with something like this:

q := queryAPI.Query(context.Background()).Bucket("my-bucket").Range("-1h").Filter("...")
res, err := q.Execute()

Use case: Every time I need to write queries using the go client

vlastahajek commented 2 years ago

Thanks for using this library. Flux DSL is already on in the backlog. This could be added in a few months.

jjauzion commented 2 years ago

If needed, I can help and contribute ;)

vlastahajek commented 2 years ago

Any PR is welcomed 👍