Aggregates defines how an aggregator
will be able to turn a bucket
into a bucket-aggregate
.
It is a list of aggregate
automatically sorted with their start-bucket
.
This list is used by a aggregator-item
to create the aggregator
.
See the [[aggregator]] function, for details about the aggregation rules.
Aggregates defines how an `aggregator` will be able to turn a `bucket` into a `bucket-aggregate`. It is a list of `aggregate` automatically sorted with their `start-bucket`. This list is used by a `aggregator-item` to create the `aggregator`. See the [[aggregator]] function, for details about the aggregation rules. ![Aggregates entity diagram](archi/time_based/aggregates.png)
(default-start-bucket-of-first-aggregate aggregates)
(make-aggregator aggregates)
Creates the aggregator
based on the aggregates
.
aggregates
will be sorted with their start-bucket
.end-bucket
of an aggregate is nil, it is defaulted to the start-bucket
of the next one.Then, for the first aggregate
:
start-bucket-aggregate
starts to 0
.end-bucket-aggregate
is calculated based on step
and start-bucket-aggregate
.For next aggregate
s:
start-bucket-aggregate
is the end-bucket-aggregate
of the previous aggregate
.end-bucket-aggregate
is calculated in the same way, except for the last one that my be nil
if no end is defined.Creates the `aggregator` based on the `aggregates`. * The `aggregates` will be sorted with their `start-bucket`. * Default values will be added. * If the `end-bucket` of an aggregate is nil, it is defaulted to the `start-bucket` of the next one. Then, for the first `aggregate`: * `start-bucket-aggregate` starts to `0`. * `end-bucket-aggregate` is calculated based on `step` and `start-bucket-aggregate`. For next `aggregate`s: * the `start-bucket-aggregate` is the `end-bucket-aggregate` of the previous `aggregate`. * `end-bucket-aggregate` is calculated in the same way, except for the last one that my be `nil` if no end is defined.
(remove-aggregate-wo-start-bucket aggregates)
(validate aggregates)
Is empty if aggregates
is valid.
Returns errors otherwise.
Is empty if `aggregates` is valid. Returns errors otherwise.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close