Add new types Array, Boolean, Record, Math
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
a50e33ba04
commit
057a2d625e
10 changed files with 137 additions and 29 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||
|
||||
use Arendsen\FluxQueryBuilder\Formatters;
|
||||
use Arendsen\FluxQueryBuilder\Type\Record;
|
||||
|
||||
class Reduce extends Base
|
||||
{
|
||||
|
|
@ -24,16 +25,8 @@ class Reduce extends Base
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
return '|> reduce(fn: (r, accumulator) => ({' . implode(', ', $this->formatSettings($this->settings)) . '}), ' .
|
||||
'identity: {' . Formatters::toFluxArrayString($this->identity) . '}) ';
|
||||
return '|> reduce(fn: (r, accumulator) => (' . new Record($this->settings) . '), ' .
|
||||
'identity: ' . new Record($this->identity) . ') ';
|
||||
}
|
||||
|
||||
protected function formatSettings(array $settings)
|
||||
{
|
||||
array_walk($settings, function (&$value, $key) {
|
||||
$value = $key . ': ' . $value;
|
||||
});
|
||||
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue