Add functions docs page
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
1e8070fc61
commit
cecee3d307
4 changed files with 83 additions and 4 deletions
|
|
@ -12,7 +12,10 @@ composer require arendsen/fluxquerybuilder
|
||||||
## Documentation
|
## Documentation
|
||||||
The documentation of this project is available in the [docs folder](docs/00-index.md).
|
The documentation of this project is available in the [docs folder](docs/00-index.md).
|
||||||
|
|
||||||
|
Go directly to our [Getting started page](docs/01-getting-started.md)
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
To execute the testing suite:
|
||||||
|
|
||||||
```
|
```
|
||||||
composer test
|
composer test
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Welcome to the documentation of the PHP Flux Query Builder.
|
||||||
* [Getting started](01-getting-started.md)
|
* [Getting started](01-getting-started.md)
|
||||||
* [InfluxDB concepts](02-what-is-influxdb.md)
|
* [InfluxDB concepts](02-what-is-influxdb.md)
|
||||||
* [What is Flux?](03-what-is-flux.md)
|
* [What is Flux?](03-what-is-flux.md)
|
||||||
|
* [Functions](04-functions.md)
|
||||||
* [Official InfluxDB documentation](https://docs.influxdata.com/influxdb/v2.6/query-data/flux/)
|
* [Official InfluxDB documentation](https://docs.influxdata.com/influxdb/v2.6/query-data/flux/)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ $queryBuilder->fromBucket('test_bucket')
|
||||||
->fromMeasurement('test_measurement')
|
->fromMeasurement('test_measurement')
|
||||||
->addFieldFilter(['username', 'email'])
|
->addFieldFilter(['username', 'email'])
|
||||||
->addKeyFilter(
|
->addKeyFilter(
|
||||||
KeyFilter::setEqualTo('_field', 'username')
|
KeyFilter::setEqualTo('username', 'David')
|
||||||
->orEqualTo('_field', 'email')
|
->andEqualTo('email', 'david@example.com')
|
||||||
)
|
)
|
||||||
->limit(50, 100);
|
->limit(50, 100);
|
||||||
|
|
||||||
|
|
@ -39,7 +39,9 @@ from(bucket: "test_bucket")
|
||||||
r._field == "username" or r._field == "email"
|
r._field == "username" or r._field == "email"
|
||||||
)
|
)
|
||||||
|> filter(fn: (r) =>
|
|> filter(fn: (r) =>
|
||||||
r._field == "username" or r._field == "email"
|
r.username == "David" and r.email == "david@example.com"
|
||||||
)
|
)
|
||||||
|> limit(n: 50, offset: 100)
|
|> limit(n: 50, offset: 100)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For a deeper dive into the possible methods of the Query builder you can check [this page](04-functions.md).
|
||||||
73
docs/04-functions.md
Normal file
73
docs/04-functions.md
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
# Flux Query Builder Docs
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
On this page you will find the methods you can use in the query builder.
|
||||||
|
|
||||||
|
### addAggregateWindow()
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Data type</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Example</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>every</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>Duration of time between windows.</td>
|
||||||
|
<td>20s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>fn</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>Aggregate or selector function to apply to each time window.</td>
|
||||||
|
<td>mean</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>options</td>
|
||||||
|
<td>array</td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
period (string): <i>Duration of windows. Default is the 'every' value.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
offset (string): <i>Duration to shift the window boundaries by. Default is '0s'.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
location (string): <i>Location used to determine timezone. Default is the 'location' option.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
column (string): <i>Column to operate on.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
timeSrc (string): <i>Column to use as the source of the new time value for aggregate values. Default is '_stop'.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
timeDst (string): <i>Column to store time values for aggregate values in. Default is '_time'.</i>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
createEmpty (boolean): <i>Create empty tables for empty window. Default is true.</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>period: <i>'every'</i></li>
|
||||||
|
<li>offset: <i>'2s'</i></li>
|
||||||
|
<li>location: <i>'location'</i></li>
|
||||||
|
<li>column: <i>'_value'</i></li>
|
||||||
|
<li>timeSrc: <i>'_stop'</i></li>
|
||||||
|
<li>timeDst: <i>'_time'</i></li>
|
||||||
|
<li>createEmpty: <i>false</i></li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue