influxdata / influxdb1-client

The old clientv2 for InfluxDB 1.x
MIT License
190 stars 112 forks source link

Better examples showing querying database? #20

Open DarrienG opened 5 years ago

DarrienG commented 5 years ago

Right now the examples for querying show querying and immediately printing the result. It would be helpful to add an example showing a user querying and getting the structured data.

The struct returned is interesting https://godoc.org/github.com/influxdata/influxdb1-client/models#Row with a map, list, and list of lists of interface{}. A better example would be awesome.

andig commented 4 years ago

Also missing any example how to actually use query params. How is the Parameters map used from the query expression? Any help welcome, I'm stuck...

For example, this needs a proper documentation:

    q := client.NewQuery("SELECT value FROM /[a-zA-Z]+Power/ WHERE time > since", "evcc", "")
    q.Parameters = map[string]interface{}{
        "since": time.Now().String(),
    }

invalid operation: time and *influxql.VarRef are not compatible
[{StatementId:0 Series:[] Messages:[] Err:invalid operation: time and *influxql.VarRef are not compatible}]