Flux query builder for PHP.
Find a file
davidarendsen f992d505dd Update README
Signed-off-by: davidarendsen <davidarendsen@hey.com>
2022-08-11 12:52:51 +00:00
src Add Formatters 2022-08-11 12:42:43 +00:00
tests Make it possible to also add integers as KeyValue value 2022-08-10 16:17:21 +00:00
.gitignore Add Flux from() and filter() methods 2022-08-05 15:41:38 +00:00
composer.json Add Flux from() and filter() methods 2022-08-05 15:41:38 +00:00
composer.lock Add Flux from() and filter() methods 2022-08-05 15:41:38 +00:00
phpunit.xml Add Flux from() and filter() methods 2022-08-05 15:41:38 +00:00
README.md Update README 2022-08-11 12:52:51 +00:00

InfluxDB 2.x Flux Query Builder

With this query builder you can build queries for Flux. See https://docs.influxdata.com/influxdb/v2.3/query-data/flux/

Installation

composer require arendsen/fluxquerybuilder

Example usage

<?php

use Arendsen\FluxQueryBuilder\QueryBuilder;
use Arendsen\FluxQueryBuilder\Expression\KeyValue;

$queryBuilder = new QueryBuilder();
$queryBuilder->fromBucket('test_bucket')
    ->fromMeasurement('test_measurement')
    ->addRangeStart('-3h')
    ->addFilter(
        KeyValue::setEqualTo('_field', 'username')
            ->orEqualTo('_field', 'email')
    )
    ->addMap('r with name: r.user')
    ->addGroup(['_field', 'ip']);

Testing

php vendor/bin/phpunit --testdox