Add Group, Limit, Map, Sort functions
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
1922f33c5c
commit
147b2d9017
11 changed files with 252 additions and 2 deletions
32
src/Function/Group.php
Normal file
32
src/Function/Group.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Arendsen\FluxQueryBuilder\Function;
|
||||
|
||||
class Group extends Base {
|
||||
|
||||
/**
|
||||
* @var array $columns
|
||||
*/
|
||||
private $columns;
|
||||
|
||||
/**
|
||||
* @var string $mode
|
||||
*/
|
||||
private $mode;
|
||||
|
||||
public function __construct(array $columns, string $mode = 'by')
|
||||
{
|
||||
$this->columns = $columns;
|
||||
$this->mode = $mode;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$columns = array_map(function($column) {
|
||||
return '"' . $column . '"';
|
||||
}, $this->columns);
|
||||
|
||||
return '|> group(columns: [' . implode(', ', $columns) . '], mode: "' . $this->mode . '") ';
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue