Make it possible to also add integers as KeyValue value
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
147b2d9017
commit
eb6568de10
2 changed files with 24 additions and 21 deletions
|
|
@ -97,12 +97,12 @@ final class QueryBuilderTest extends TestCase {
|
|||
->addMap('r with name: r.user')
|
||||
->addGroup(['_field', 'ip'])
|
||||
->addReduce(['count' => 'accumulator.count + 1'], ['count' => 0])
|
||||
->addFilter(KeyValue::setGreaterOrEqualTo('count', '1'));
|
||||
->addFilter(KeyValue::setGreaterOrEqualTo('count', 1)->andGreaterOrEqualTo('count2', 2));
|
||||
|
||||
$expectedQuery = 'from(bucket: "test_bucket") |> range(start: "-3h") ' .
|
||||
'|> reduce(fn: (r, accumulator) => ({count: accumulator.count + 1}), identity: {count: 0}) ' .
|
||||
'|> filter(fn: (r) => r._measurement == "test_measurement") |> filter(fn: (r) => r._field == "username") ' .
|
||||
'|> filter(fn: (r) => r.count >= "1") |> map(fn: (r) => ({ r with name: r.user })) ' .
|
||||
'|> filter(fn: (r) => r.count >= 1 and r.count2 >= 2) |> map(fn: (r) => ({ r with name: r.user })) ' .
|
||||
'|> group(columns: ["_field", "ip"], mode: "by") ';
|
||||
|
||||
$this->assertEquals($expectedQuery, $queryBuilder->build());
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue