-
Notifications
You must be signed in to change notification settings - Fork 0
/
query.go
42 lines (36 loc) · 1.13 KB
/
query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package aggro
import "time"
// Query represents the bucketing and aggregate metrics that should be run.
type Query struct {
Bucket *Bucket
Metrics []Metric
}
// Bucket defines how to compare and group data which is then aggregated on.
type Bucket struct {
Bucket *Bucket
Field *Field
DatetimeOptions *DatetimeBucketOptions
Sort *SortOptions
RangeOptions *RangeBucketOptions
}
// SortOptions represent how this Bucket should be sorted.
type SortOptions struct {
Type string
Metric string
Desc bool
}
// DatetimeBucketOptions provides additional configuration for datetime bucketing.
type DatetimeBucketOptions struct {
// Start will, if provided, ensure buckets start at this date.
Start *time.Time
// End will, if provided, ensure buckets continue to this date.
End *time.Time
// What interval period are the results to be bucketed at.
Period DatetimePeriod
// Datetimes should be bucketed based on the date in this location.
Location *time.Location
}
// RangeBucketOptions provides additional configuration for custom range bucketing.
type RangeBucketOptions struct {
Period []interface{}
}