Add addCount, addFirst, addMax, and addMin functions
Signed-off-by: David Arendsen <darendsen@gamepoint.com>
This commit is contained in:
parent
b7e0b21c8f
commit
fc99922700
15 changed files with 463 additions and 23 deletions
27
src/Functions/Count.php
Normal file
27
src/Functions/Count.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Type;
|
||||
|
||||
class Count extends Base
|
||||
{
|
||||
/**
|
||||
* @var string|null $column
|
||||
*/
|
||||
private $column;
|
||||
|
||||
public function __construct(?string $column = null)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = new Type(array_filter([
|
||||
'column' => $this->column
|
||||
]));
|
||||
|
||||
return '|> count(' . $params . ') ';
|
||||
}
|
||||
}
|
||||
27
src/Functions/First.php
Normal file
27
src/Functions/First.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Type;
|
||||
|
||||
class First extends Base
|
||||
{
|
||||
/**
|
||||
* @var string|null $column
|
||||
*/
|
||||
private $column;
|
||||
|
||||
public function __construct(?string $column = null)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = new Type(array_filter([
|
||||
'column' => $this->column
|
||||
]));
|
||||
|
||||
return '|> first(' . $params . ') ';
|
||||
}
|
||||
}
|
||||
27
src/Functions/Max.php
Normal file
27
src/Functions/Max.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Type;
|
||||
|
||||
class Max extends Base
|
||||
{
|
||||
/**
|
||||
* @var string|null $column
|
||||
*/
|
||||
private $column;
|
||||
|
||||
public function __construct(?string $column = null)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = new Type(array_filter([
|
||||
'column' => $this->column
|
||||
]));
|
||||
|
||||
return '|> max(' . $params . ') ';
|
||||
}
|
||||
}
|
||||
27
src/Functions/Min.php
Normal file
27
src/Functions/Min.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Type;
|
||||
|
||||
class Min extends Base
|
||||
{
|
||||
/**
|
||||
* @var string|null $column
|
||||
*/
|
||||
private $column;
|
||||
|
||||
public function __construct(?string $column = null)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$params = new Type(array_filter([
|
||||
'column' => $this->column
|
||||
]));
|
||||
|
||||
return '|> min(' . $params . ') ';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue