Add window() function to Query Builder
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
9bea683e89
commit
ab03c2b56e
6 changed files with 141 additions and 1 deletions
30
tests/Functions/WindowFunctionTest.php
Normal file
30
tests/Functions/WindowFunctionTest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Functions\Window;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class WindowFunctionTest extends TestCase
|
||||
{
|
||||
public function testSimpleWindow()
|
||||
{
|
||||
$expression = new Window('20s');
|
||||
|
||||
$query = '|> window(every: 20s) ';
|
||||
|
||||
$this->assertEquals($query, $expression->__toString());
|
||||
}
|
||||
|
||||
public function testAllParameters()
|
||||
{
|
||||
$expression = new Window('20s', 'every', '0s', 'location', '_time', '_start', '_stop', true);
|
||||
|
||||
$query = '|> window(every: 20s, period: every, offset: 0s, location: "location", ' .
|
||||
'timeColumn: "_time", startColumn: "_start", stopColumn: "_stop", createEmpty: true) ';
|
||||
|
||||
$this->assertEquals($query, $expression->__toString());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue