Initial commit
This commit is contained in:
27
src/Protocol/Query/Components/ContainsAggregation.php
Normal file
27
src/Protocol/Query/Components/ContainsAggregation.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Toalett\Redis\Timeseries\Protocol\Query\Components;
|
||||
|
||||
use Toalett\Redis\Timeseries\Model\Aggregation;
|
||||
|
||||
trait ContainsAggregation
|
||||
{
|
||||
protected ?Aggregation $aggregation = null;
|
||||
|
||||
public function aggregate(Aggregation $aggregation): self
|
||||
{
|
||||
$this->aggregation = $aggregation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function appendAggregation(array $command): array
|
||||
{
|
||||
if (!is_null($this->aggregation)) {
|
||||
$command[] = 'AGGREGATION';
|
||||
$command[] = $this->aggregation->type;
|
||||
$command[] = $this->aggregation->timeBucket;
|
||||
}
|
||||
|
||||
return $command;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user