Add Flux from() and filter() methods
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
af750eb635
commit
e0e69b4beb
17 changed files with 2095 additions and 0 deletions
15
src/Expression/Base.php
Normal file
15
src/Expression/Base.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Expression;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
/**
|
||||
* @throws ExpressionNotImplementedException
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
throw new ExpressionNotImplementedException('__toString', get_class($this));
|
||||
}
|
||||
|
||||
}
|
||||
7
src/Expression/ExpressionNotImplementedException.php
Normal file
7
src/Expression/ExpressionNotImplementedException.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Expression;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ExpressionNotImplementedException extends Exception {}
|
||||
30
src/Expression/Filter/AndExpression.php
Normal file
30
src/Expression/Filter/AndExpression.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Expression\Filter;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Expression\Base;
|
||||
|
||||
class AndExpression extends Base {
|
||||
|
||||
/**
|
||||
* @var string $key
|
||||
*/
|
||||
private $key;
|
||||
|
||||
/**
|
||||
* @var string $value
|
||||
*/
|
||||
private $value;
|
||||
|
||||
public function __construct(string $key, string $value)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return 'and r.' . $this->key . ' == "' . $this->value . '"';
|
||||
}
|
||||
|
||||
}
|
||||
24
src/Expression/Filter/Measurement.php
Normal file
24
src/Expression/Filter/Measurement.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Expression\Filter;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Expression\Base;
|
||||
|
||||
class Measurement extends Base {
|
||||
|
||||
/**
|
||||
* @var array $measurement
|
||||
*/
|
||||
private $measurement;
|
||||
|
||||
public function __construct(string $measurement)
|
||||
{
|
||||
$this->measurement = $measurement;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return 'r._measurement == "' . $this->measurement . '"';
|
||||
}
|
||||
|
||||
}
|
||||
30
src/Expression/Filter/OrExpression.php
Normal file
30
src/Expression/Filter/OrExpression.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Expression\Filter;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Expression\Base;
|
||||
|
||||
class OrExpression extends Base {
|
||||
|
||||
/**
|
||||
* @var string $key
|
||||
*/
|
||||
private $key;
|
||||
|
||||
/**
|
||||
* @var string $value
|
||||
*/
|
||||
private $value;
|
||||
|
||||
public function __construct(string $key, string $value)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return 'or r.' . $this->key . ' == "' . $this->value . '"';
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue