Add aggregateWindow() function to Query Builder
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
68ae5f2760
commit
075857a83b
5 changed files with 172 additions and 2 deletions
30
tests/Functions/AggregateWindowTest.php
Normal file
30
tests/Functions/AggregateWindowTest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Functions\AggregateWindow;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class AggregateWindowFunctionTest extends TestCase
|
||||
{
|
||||
public function testSimpleWindow()
|
||||
{
|
||||
$expression = new AggregateWindow('20s', null, null, 'mean');
|
||||
|
||||
$query = '|> aggregateWindow(every: 20s, fn: mean) ';
|
||||
|
||||
$this->assertEquals($query, $expression->__toString());
|
||||
}
|
||||
|
||||
public function testAllParameters()
|
||||
{
|
||||
$expression = new AggregateWindow('20s', 'every', '0s', 'mean', 'location', '_value', '_stop', '_time', false);
|
||||
|
||||
$query = '|> aggregateWindow(every: 20s, period: every, offset: 0s, fn: mean, location: "location", ' .
|
||||
'column: "_value", timeSrc: "_stop", timeDst: "_time", createEmpty: false) ';
|
||||
|
||||
$this->assertEquals($query, $expression->__toString());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue