Documentation
¶
Index ¶
- Constants
- Variables
- type AggRefer
- type Aggregation
- func AggCardinality(name string, fieldNames []string, byRow ...bool) Aggregation
- func AggCount(name string) Aggregation
- func AggDoubleSum(name, fieldName string) Aggregation
- func AggJavaScript(name, fnAggregate, fnCombine, fnReset string, fieldNames []string) Aggregation
- func AggLongMax(name, fieldName string) Aggregation
- func AggLongMin(name, fieldName string) Aggregation
- func AggLongSum(name, fieldName string) Aggregation
- func AggMax(name, fieldName string) Aggregation
- func AggMin(name, fieldName string) Aggregation
- func AggRawJson(rawJson string) Aggregation
- func FilteredAgg(filter *Filter, aggregation Aggregation) Aggregation
- type Aggregator
- type Client
- type Column
- type ColumnItem
- type DimExtractionFn
- type DimSpec
- type DimValue
- type Dimension
- type ExtractionFn
- type Filter
- func FilterAnd(filters ...*Filter) *Filter
- func FilterCaseInsensitiveContains(dimension string, value string) *Filter
- func FilterCaseSensitiveContains(dimension string, value string) *Filter
- func FilterGt(dimension string, value string, ordering string) *Filter
- func FilterGte(dimension string, value string, ordering string) *Filter
- func FilterInClause(dimension string, values []interface{}) *Filter
- func FilterJavaScript(dimension, function string) *Filter
- func FilterLt(dimension string, value string, ordering string) *Filter
- func FilterLte(dimension string, value string, ordering string) *Filter
- func FilterNot(filter *Filter) *Filter
- func FilterOr(filters ...*Filter) *Filter
- func FilterRange(dimension string, lower string, upper string, lowerStrict bool, ...) *Filter
- func FilterRangeIncl(dimension string, lower string, upper string, ordering string) *Filter
- func FilterRegex(dimension, pattern string) *Filter
- func FilterSelector(dimension string, value interface{}) *Filter
- type FilteredAggregator
- type GranDuration
- type GranPeriod
- type Granlarity
- type GroupByItem
- type GroupByItemGeneric
- type GroupbyItem
- type Having
- func HavingAnd(havings ...*Having) *Having
- func HavingEqualTo(agg string, value interface{}) *Having
- func HavingGreaterThan(agg string, value interface{}) *Having
- func HavingLessThan(agg string, value interface{}) *Having
- func HavingNot(having *Having) *Having
- func HavingOr(havings ...*Having) *Having
- type Limit
- type PostAggregation
- func PostAggArithmetic(name, fn string, fields []PostAggregation) PostAggregation
- func PostAggConstant(name string, value interface{}) PostAggregation
- func PostAggFieldAccessor(fieldName string) PostAggregation
- func PostAggFieldHyperUnique(fieldName string) PostAggregation
- func PostAggJavaScript(name, function string, fieldNames []string) PostAggregation
- func PostAggRawJson(rawJson string) PostAggregation
- type Query
- type QueryGroupBy
- type QueryGroupByGeneric
- type QueryScan
- type QueryScanGeneric
- type QuerySearch
- type QuerySegmentMetadata
- type QueryTimeBoundary
- type QueryTimeseries
- type QueryTimeseriesGeneric
- type QueryTopN
- type QueryTopNGeneric
- type ScanBlob
- type ScanBlobGeneric
- type SearchItem
- type SearchQuery
- type SearchQuerySpec
- type SearchSort
- type SegmentMetaData
- type SimpleGran
- type TimeBoundary
- type TimeBoundaryItem
- type Timeseries
- type TimeseriesGeneric
- type ToInclude
- type TopNItem
- type TopNItemGeneric
- type TopNMetric
Constants ¶
const ( DirectionASC = "ASCENDING" DirectionDESC = "DESCENDING" )
const (
DefaultEndPoint = "/druid/v2"
)
Variables ¶
var ( ToIncludeAll = &ToInclude{Type: "All"} ToIncludeNone = &ToInclude{Type: "None"} )
var ( SearchSortLexicographic = &SearchSort{Type: "lexicographic"} SearchSortStrlen = &SearchSort{Type: "strlen"} )
Functions ¶
This section is empty.
Types ¶
type AggRefer ¶
type AggRefer struct {
Name string
Refer string // The refer of Name, empty means Name has no refer.
}
The agg reference.
type Aggregation ¶
type Aggregation struct {
Aggregator
FilteredAggregator
}
func AggCardinality ¶
func AggCardinality(name string, fieldNames []string, byRow ...bool) Aggregation
func AggCount ¶
func AggCount(name string) Aggregation
func AggDoubleSum ¶
func AggDoubleSum(name, fieldName string) Aggregation
func AggJavaScript ¶
func AggJavaScript(name, fnAggregate, fnCombine, fnReset string, fieldNames []string) Aggregation
func AggLongMax ¶
func AggLongMax(name, fieldName string) Aggregation
func AggLongMin ¶
func AggLongMin(name, fieldName string) Aggregation
func AggLongSum ¶
func AggLongSum(name, fieldName string) Aggregation
func AggMax ¶
func AggMax(name, fieldName string) Aggregation
func AggMin ¶
func AggMin(name, fieldName string) Aggregation
func AggRawJson ¶
func AggRawJson(rawJson string) Aggregation
func FilteredAgg ¶
func FilteredAgg(filter *Filter, aggregation Aggregation) Aggregation
type Aggregator ¶
type Aggregator struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
FieldName string `json:"fieldName,omitempty"`
FieldNames []string `json:"fieldNames,omitempty"`
FnAggregate string `json:"fnAggregate,omitempty"`
FnCombine string `json:"fnCombine,omitempty"`
FnReset string `json:"fnReset,omitempty"`
ByRow bool `json:"byRow,omitempty"`
}
type Client ¶
type Client struct {
Url string
EndPoint string
Timeout time.Duration
Debug bool
LastRequest string
LastResponse string
}
func (*Client) QueryRawWithContext ¶
type ColumnItem ¶
type DimExtractionFn ¶
type DimExtractionFn struct {
Type string `json:"type"`
Expr string `json:"expr,omitempty"`
Query *SearchQuery `json:"query,omitempty"`
TimeFormat string `json:"timeFormat,omitempty"`
ResultFormat string `json:"resultFormat,omitempty"`
Function string `json:"function,omitempty"`
}
func DimExFnJavascript ¶
func DimExFnJavascript(function string) *DimExtractionFn
func DimExFnPartial ¶
func DimExFnPartial(expr string) *DimExtractionFn
func DimExFnRegex ¶
func DimExFnRegex(expr string) *DimExtractionFn
func DimExFnSearchQuerySpec ¶
func DimExFnSearchQuerySpec(query *SearchQuery) *DimExtractionFn
func DimExFnTime ¶
func DimExFnTime(timeFormat, resultFormat string) *DimExtractionFn
type DimSpec ¶
type DimSpec interface{}
func DimDefault ¶
func DimExtraction ¶
func DimExtraction(dimension, outputName string, fn *DimExtractionFn) DimSpec
type Dimension ¶
type Dimension struct {
Type string `json:"type"`
Dimension string `json:"dimension"`
OutputName string `json:"outputName"`
DimExtractionFn *DimExtractionFn `json:"dimExtractionFn,omitempty"`
}
type ExtractionFn ¶
type ExtractionFn struct {
Type string `json:"type"`
}
See https://druid.apache.org/docs/latest/querying/dimensionspecs.html#extraction-functions for details.
type Filter ¶
type Filter struct {
Type string `json:"type"`
Dimension string `json:"dimension,omitempty"`
Value interface{} `json:"value,omitempty"`
Values []interface{} `json:"values,omitempty"`
Pattern string `json:"pattern,omitempty"`
Function string `json:"function,omitempty"`
Lower string `json:"lower,omitempty"`
Upper string `json:"upper,omitempty"`
LowerStrict *bool `json:"lowerStrict,omitempty"`
UpperStrict *bool `json:"upperStrict,omitempty"`
Ordering string `json:"ordering,omitempty"`
Field *Filter `json:"field,omitempty"`
Fields []*Filter `json:"fields,omitempty"`
SearchSpec *SearchQuerySpec `json:"query,omitempty"`
ExtractionFn *ExtractionFn `json:"extractionFn,omitempty"`
}
func FilterInClause ¶
func FilterJavaScript ¶
func FilterRange ¶
func FilterRange(dimension string, lower string, upper string, lowerStrict bool, upperStrict bool, ordering string) *Filter
Filter for range operation. Takes input lowerStrict and upperStrict options. If lowerStrict = true, lower < value else lower <= value. If upperStrict = true, value < upper else value <= upper.
func FilterRangeIncl ¶
Filter for range filter, i.e. lower <= value <= upper
func FilterRegex ¶
func FilterSelector ¶
type FilteredAggregator ¶
type FilteredAggregator struct {
Filter *Filter `json:"filter,omitempty"`
Aggregator Aggregator `json:"aggregator,omitempty"`
}
type GranDuration ¶
type GranPeriod ¶
type Granlarity ¶
type Granlarity interface{}
type GroupByItem ¶
type GroupByItemGeneric ¶
type GroupByItemGeneric[T any] struct { Version string `json:"version"` Timestamp string `json:"timestamp"` Event T `json:"event"` }
GroupByItemGeneric is the response to groupBy query but with a generic type.
type Having ¶
type Having struct {
Type string `json:"type"`
Aggregation string `json:"aggregation,omitempty"`
Value interface{} `json:"value,omitempty"`
HavingSpec *Having `json:"havingSpec,omitempty"`
HavingSpecs []*Having `json:"havingSpecs,omitempty"`
}
func HavingEqualTo ¶
func HavingGreaterThan ¶
func HavingLessThan ¶
type Limit ¶
type Limit struct {
Type string `json:"type"`
Limit int `json:"limit"`
Columns []Column `json:"columns,omitempty"`
}
func LimitDefault ¶
type PostAggregation ¶
type PostAggregation struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
Value interface{} `json:"value,omitempty"`
Fn string `json:"fn,omitempty"`
Fields []PostAggregation `json:"fields,omitempty"`
FieldName string `json:"fieldName,omitempty"`
FieldNames []string `json:"fieldNames,omitempty"`
Function string `json:"function,omitempty"`
}
func PostAggArithmetic ¶
func PostAggArithmetic(name, fn string, fields []PostAggregation) PostAggregation
func PostAggConstant ¶
func PostAggConstant(name string, value interface{}) PostAggregation
func PostAggFieldAccessor ¶
func PostAggFieldAccessor(fieldName string) PostAggregation
func PostAggFieldHyperUnique ¶
func PostAggFieldHyperUnique(fieldName string) PostAggregation
func PostAggJavaScript ¶
func PostAggJavaScript(name, function string, fieldNames []string) PostAggregation
func PostAggRawJson ¶
func PostAggRawJson(rawJson string) PostAggregation
func (PostAggregation) GetReferAggs ¶
func (pa PostAggregation) GetReferAggs(parentName ...string) (refers []AggRefer)
Return the aggregations or post aggregations which this post aggregation used. It could be helpful while automatically filling the aggregations or post aggregations base on this.
type Query ¶
type Query interface {
// contains filtered or unexported methods
}
The Query interface stands for any kinds of druid query.
type QueryGroupBy ¶
type QueryGroupBy struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Dimensions []DimSpec `json:"dimensions"`
Granularity Granlarity `json:"granularity"`
LimitSpec *Limit `json:"limitSpec,omitempty"`
Having *Having `json:"having,omitempty"`
Filter *Filter `json:"filter,omitempty"`
Aggregations []Aggregation `json:"aggregations"`
PostAggregations []PostAggregation `json:"postAggregations,omitempty"`
Intervals []string `json:"intervals"`
Context map[string]interface{} `json:"context,omitempty"`
QueryResult []GroupByItem `json:"-"`
}
type QueryGroupByGeneric ¶
type QueryGroupByGeneric[T any] struct { *QueryGroupBy QueryResult []GroupByItemGeneric[T] `json:"-"` }
QueryGroupByGeneric is the model for groupBy query but with a generic response type.
func (*QueryGroupByGeneric[T]) Results ¶
func (q *QueryGroupByGeneric[T]) Results() []T
Results flattens the groupBy results as 1 large array.
type QueryScan ¶
type QueryScan struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Columns []string `json:"columns"`
Intervals []string `json:"intervals"`
BatchSize int64 `json:"batchSize"`
Limit int64 `json:"limit"`
Offset int64 `json:"offset"`
Order string `json:"order,omitempty"`
Filter *Filter `json:"filter,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
ResultFormat string `json:"resultFormat,omitempty"`
Legacy bool `json:"legacy,omitempty"`
QueryResult []ScanBlob `json:"-"`
// EventHandler, when set, is called once per decoded event during streaming.
// QueryResult will not be populated; the caller receives events inline.
EventHandler func(event map[string]interface{}) `json:"-"`
}
QueryScan is the model for scan query
type QueryScanGeneric ¶
type QueryScanGeneric[T any] struct { *QueryScan QueryResult []ScanBlobGeneric[T] `json:"-"` }
QueryScanGeneric is the model for scan query but with a generic response type.
func (*QueryScanGeneric[T]) Results ¶
func (q *QueryScanGeneric[T]) Results() []T
Results flattens the scan blobs results as 1 large array.
type QuerySearch ¶
type QuerySearch struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Granularity Granlarity `json:"granularity"`
Filter *Filter `json:"filter,omitempty"`
Intervals []string `json:"intervals"`
SearchDimensions []string `json:"searchDimensions,omitempty"`
Query *SearchQuery `json:"query"`
Sort *SearchSort `json:"sort"`
Context map[string]interface{} `json:"context,omitempty"`
QueryResult []SearchItem `json:"-"`
}
type QuerySegmentMetadata ¶
type QuerySegmentMetadata struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Intervals []string `json:"intervals"`
ToInclude *ToInclude `json:"toInclude,omitempty"`
Merge interface{} `json:"merge,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
QueryResult []SegmentMetaData `json:"-"`
}
type QueryTimeBoundary ¶
type QueryTimeseries ¶
type QueryTimeseries struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Granularity Granlarity `json:"granularity"`
Filter *Filter `json:"filter,omitempty"`
Aggregations []Aggregation `json:"aggregations"`
PostAggregations []PostAggregation `json:"postAggregations,omitempty"`
Intervals []string `json:"intervals"`
Context map[string]interface{} `json:"context,omitempty"`
QueryResult []Timeseries `json:"-"`
}
type QueryTimeseriesGeneric ¶
type QueryTimeseriesGeneric[T any] struct { *QueryTimeseries QueryResult []TimeseriesGeneric[T] `json:"-"` }
QueryTimeseriesGeneric is the model for timeseries query but with a generic response type.
func (*QueryTimeseriesGeneric[T]) Results ¶
func (q *QueryTimeseriesGeneric[T]) Results() []T
Results flattens the timeseries results as 1 large array.
type QueryTopN ¶
type QueryTopN struct {
QueryType string `json:"queryType"`
DataSource string `json:"dataSource"`
Granularity Granlarity `json:"granularity"`
Dimension DimSpec `json:"dimension"`
Threshold int `json:"threshold"`
Metric *TopNMetric `json:"metric"`
Filter *Filter `json:"filter,omitempty"`
Aggregations []Aggregation `json:"aggregations"`
PostAggregations []PostAggregation `json:"postAggregations,omitempty"`
Intervals []string `json:"intervals"`
Context map[string]interface{} `json:"context,omitempty"`
QueryResult []TopNItem `json:"-"`
}
type QueryTopNGeneric ¶
type QueryTopNGeneric[T any] struct { *QueryTopN QueryResult []TopNItemGeneric[T] `json:"-"` }
QueryTopNGeneric is the model for topn query but with a generic response type.
func (*QueryTopNGeneric[T]) Results ¶
func (q *QueryTopNGeneric[T]) Results() []T
Results flattens the results as 1 large array.
type ScanBlob ¶
type ScanBlob struct {
Columns []string `json:"columns"`
SegmentID string `json:"segmentId"`
Events []map[string]interface{} `json:"events"`
}
ScanBlob is the response to scan query
type ScanBlobGeneric ¶
type ScanBlobGeneric[T any] struct { Columns []string `json:"columns"` SegmentID string `json:"segmentId"` Events []T `json:"events"` }
ScanBlobGeneric is the response to scan query but with a generic type.
type SearchItem ¶
type SearchQuery ¶
type SearchQuery struct {
Type string `json:"type"`
Value interface{} `json:"value,omitempty"`
Values []interface{} `json:"values,omitempty"`
}
func SearchQueryFragmentSearch ¶
func SearchQueryFragmentSearch(values []interface{}) *SearchQuery
func SearchQueryInsensitiveContains ¶
func SearchQueryInsensitiveContains(value interface{}) *SearchQuery
type SearchQuerySpec ¶
type SearchSort ¶
type SearchSort struct {
Type string `json:"type"`
}
type SegmentMetaData ¶
type SegmentMetaData struct {
Id string `json:"id"`
Intervals []string `json:"intervals"`
Columns map[string]ColumnItem `json:"columns"`
}
type SimpleGran ¶
type SimpleGran string
const ( GranAll SimpleGran = "all" GranNone SimpleGran = "none" GranMinute SimpleGran = "minute" GranFifteenMin SimpleGran = "fifteen_minute" GranThirtyMin SimpleGran = "thirty_minute" GranHour SimpleGran = "hour" GranDay SimpleGran = "day" )
type TimeBoundary ¶
type TimeBoundaryItem ¶
type TimeBoundaryItem struct {
Timestamp string `json:"timestamp"`
Result TimeBoundary `json:"result"`
}
type Timeseries ¶
type TimeseriesGeneric ¶
type TimeseriesGeneric[T any] struct { Timestamp string `json:"timestamp"` Result T `json:"result"` }
TimeseriesGeneric is the response to timeseries query but with a generic type.
type ToInclude ¶
func ToIncludeList ¶
type TopNItemGeneric ¶
type TopNItemGeneric[T any] struct { Timestamp string `json:"timestamp"` Result []T `json:"result"` }
TopNItemGeneric is the response to topn query but with a generic type.
type TopNMetric ¶
type TopNMetric struct {
Type string `json:"type"`
Metric interface{} `json:"metric,omitempty"`
PreviousStop string `json:"previousStop"`
}
func TopNMetricAlphaNumeric ¶
func TopNMetricAlphaNumeric(previousStop string) *TopNMetric
func TopNMetricInverted ¶
func TopNMetricInverted(metric *TopNMetric) *TopNMetric
func TopNMetricLexicographic ¶
func TopNMetricLexicographic(previousStop string) *TopNMetric
func TopNMetricNumeric ¶
func TopNMetricNumeric(metric string) *TopNMetric