Add reduce function to QueryBuilder
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
6014384afc
commit
bdc832aaab
3 changed files with 79 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ use Arendsen\FluxQueryBuilder\Expression\KeyValue;
|
|||
use Arendsen\FluxQueryBuilder\Function\Filter;
|
||||
use Arendsen\FluxQueryBuilder\Function\From;
|
||||
use Arendsen\FluxQueryBuilder\Function\Range;
|
||||
use Arendsen\FluxQueryBuilder\Function\Reduce;
|
||||
use Exception;
|
||||
|
||||
class QueryBuilder {
|
||||
|
|
@ -13,10 +14,12 @@ class QueryBuilder {
|
|||
const FLUX_PART_FROM = 'from';
|
||||
const FLUX_PART_RANGE = 'range';
|
||||
const FLUX_PART_FILTERS = 'filters';
|
||||
const FLUX_PART_REDUCE = 'reduce';
|
||||
|
||||
const PARTS = [
|
||||
self::FLUX_PART_FROM,
|
||||
self::FLUX_PART_RANGE,
|
||||
self::FLUX_PART_REDUCE,
|
||||
self::FLUX_PART_FILTERS
|
||||
];
|
||||
|
||||
|
|
@ -91,6 +94,15 @@ class QueryBuilder {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addReduce(array $settings, array $identity): QueryBuilder
|
||||
{
|
||||
$this->addToQueryArray(
|
||||
self::FLUX_PART_REDUCE,
|
||||
new Reduce($settings, $identity)
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function addToQuery($key, $query)
|
||||
{
|
||||
$this->fluxQueryParts[$key] = $query;
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue