godruid: github.com/fannheyward/godruid Index | Files

package godruid

import "github.com/fannheyward/godruid"

Index

Package Files

aggregations.go client.go dimension_spec.go extraction_function.go filters.go granularities.go havings.go intervals.go post_aggregations.go queries.go specs.go

Constants

const (
    LOWERSTRICT = "lowerStrict"
    UPPERSTRICT = "upperStrict"
    LOWERLIMIT  = "lowerLimit"
    UPPERLIMIT  = "upperLimit"
)

Filter constants

const (
    TIMEOUT          = "timeout"
    SKIPEMPTYBUCKETS = "skipEmptyBuckets"
    QUERYID          = "queryId"
)

Context 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"}
)

func GranDuration Uses

func GranDuration(duration string, origin string) granDuration

func GranPeriod Uses

func GranPeriod(period string, timeZone string, origin string) granPeriod

type AggRefer Uses

type AggRefer struct {
    Name  string
    Refer string // The refer of Name, empty means Name has no refer.
}

The agg reference.

type Aggregation Uses

type Aggregation 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"`
    Filter      *Filter      `json:"filter,omitempty"`
    Resolution  int32        `json:"resolution,omitempty"`
    NumBuckets  int32        `json:"numBuckets,omitempty"`
    LowerLimit  string       `json:"lowerLimit,omitempty"`
    UpperLimit  string       `json:"upperLimit,omitempty"`
    Aggregator  *Aggregation `json:"aggregator,omitempty"`
    Round       bool         `json:"round,omitempty"`
}

func AggCardinality Uses

func AggCardinality(name string, fieldNames []string, byRow ...bool) Aggregation

func AggCount Uses

func AggCount(name string) *Aggregation

func AggDoubleMax Uses

func AggDoubleMax(name, fieldName string) *Aggregation

func AggDoubleMin Uses

func AggDoubleMin(name, fieldName string) *Aggregation

func AggDoubleSum Uses

func AggDoubleSum(name, fieldName string) *Aggregation

func AggFiltered Uses

func AggFiltered(filter *Filter, aggregator *Aggregation) Aggregation

func AggHistoFold Uses

func AggHistoFold(name string, fieldName string, resolution int32, numBuckets int32, lowerLimit string, upperLimit string) Aggregation

func AggJavaScript Uses

func AggJavaScript(name, fnAggregate, fnCombine, fnReset string, fieldNames []string) Aggregation

func AggLongMax Uses

func AggLongMax(name, fieldName string) *Aggregation

func AggLongMin Uses

func AggLongMin(name, fieldName string) *Aggregation

func AggLongSum Uses

func AggLongSum(name, fieldName string) *Aggregation

func AggMax Uses

func AggMax(name, fieldName string) *Aggregation

func AggMin Uses

func AggMin(name, fieldName string) *Aggregation

func AggRawJson Uses

func AggRawJson(rawJson string) *Aggregation

type Client Uses

type Client struct {
    Url      string
    EndPoint string

    Debug        bool
    LastRequest  string
    LastResponse string
    HttpClient   *http.Client
}

func (*Client) Query Uses

func (c *Client) Query(query Query, authToken string) (err error)

func (*Client) QueryRaw Uses

func (c *Client) QueryRaw(req []byte, authToken string) (result []byte, err error)

type Column Uses

type Column struct {
    AsNumber  bool   `json:"asNumber"`
    Dimension string `json:"dimension"`
    Direction string `json:"direction"`
}

type ColumnItem Uses

type ColumnItem struct {
    Type        string      `json:"type"`
    Size        int         `json:"size"`
    Cardinality interface{} `json:"cardinality"`
}

type DimExtractionFn Uses

type DimExtractionFn struct {
    Type        string       `json:"type"`
    Expr        string       `json:"expr,omitempty"`
    Query       *SearchQuery `json:"query,omitempty"`
    Format      string       `json:"format,omitempty"`
    Function    string       `json:"function,omitempty"`
    TimeZone    string       `json:"timeZone,omitempty"`
    Locale      string       `json:"locale,omitempty"`
    Granularity string       `json:"granularity,omitempty"`
    AsMillis    bool         `json:"asMillis,omitempty"`
}

func DimExFnJavascript Uses

func DimExFnJavascript(function string) *DimExtractionFn

func DimExFnPartial Uses

func DimExFnPartial(expr string) *DimExtractionFn

func DimExFnRegex Uses

func DimExFnRegex(expr string) *DimExtractionFn

func DimExFnSearchQuerySpec Uses

func DimExFnSearchQuerySpec(query *SearchQuery) *DimExtractionFn

func DimExFnTime Uses

func DimExFnTime(timeFormat, timeZone string, locale string, granularity string, asMillis bool) *DimExtractionFn

type DimSpec Uses

type DimSpec interface{}

func DimDefault Uses

func DimDefault(dimension, outputName string) DimSpec

func DimExtraction Uses

func DimExtraction(dimension, outputName string, fn *DimExtractionFn) DimSpec

type DimValue Uses

type DimValue struct {
    Dimension string `json:"dimension"`
    Value     string `json:"value"`
    Count     int    `json:"count"`
}

type Dimension Uses

type Dimension struct {
    Type         string           `json:"type"`
    Dimension    string           `json:"dimension"`
    OutputName   string           `json:"outputName"`
    ExtractionFn *DimExtractionFn `json:"extractionFn,omitempty"`
}

type ExtractionFn Uses

type ExtractionFn interface{}

type Filter Uses

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"`
    Field        *Filter       `json:"field,omitempty"`
    Fields       []*Filter     `json:"fields,omitempty"`
    Upper        float32       `json:"upper,omitempty"`
    Lower        float32       `json:"lower,omitempty"`
    Ordering     Ordering      `json:"ordering,omitempty"`
    UpperStrict  bool          `json:"upperStrict,omitempty"`
    LowerStrict  bool          `json:"lowerStrict,omitempty"`
    ExtractionFn *ExtractionFn `json:"extractionFn,omitempty"`
}

func FilterAnd Uses

func FilterAnd(filters ...*Filter) *Filter

func FilterJavaScript Uses

func FilterJavaScript(dimension, function string) *Filter

func FilterLowerBound Uses

func FilterLowerBound(dimension string, ordering Ordering, bound float32, strict bool) *Filter

func FilterLowerUpperBound Uses

func FilterLowerUpperBound(dimension string, ordering Ordering, lowerBound float32, lowerStrict bool, upperBound float32, upperStrict bool) *Filter

func FilterNot Uses

func FilterNot(filter *Filter) *Filter

func FilterOr Uses

func FilterOr(filters ...*Filter) *Filter

func FilterRegex Uses

func FilterRegex(dimension, pattern string) *Filter

func FilterSelector Uses

func FilterSelector(dimension string, value interface{}) *Filter

func FilterUpperBound Uses

func FilterUpperBound(dimension string, ordering Ordering, bound float32, strict bool) *Filter

type Granlarity Uses

type Granlarity interface{}

type GroupbyItem Uses

type GroupbyItem struct {
    Version   string                 `json:"version"`
    Timestamp string                 `json:"timestamp"`
    Event     map[string]interface{} `json:"event"`
}

type Having Uses

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 HavingAnd Uses

func HavingAnd(havings ...*Having) *Having

func HavingEqualTo Uses

func HavingEqualTo(agg string, value interface{}) *Having

func HavingGreaterThan Uses

func HavingGreaterThan(agg string, value interface{}) *Having

func HavingLessThan Uses

func HavingLessThan(agg string, value interface{}) *Having

func HavingNot Uses

func HavingNot(having *Having) *Having

func HavingOr Uses

func HavingOr(havings ...*Having) *Having

type Intervals Uses

type Intervals interface{}

type Limit Uses

type Limit struct {
    Type    string   `json:"type"`
    Limit   int      `json:"limit"`
    Columns []Column `json:"columns,omitempty"`
}

func LimitDefault Uses

func LimitDefault(limit int, columns ...[]Column) *Limit

type Ordering Uses

type Ordering string
const (
    LEXICOGRAPHIC Ordering = "lexicographic"
    ALPHANUMERIC  Ordering = "alphanumeric"
    NUMERIC       Ordering = "numeric"
    STRLEN        Ordering = "strlen"
)

type PostAggregation Uses

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 Uses

func PostAggArithmetic(name, fn string, fields []PostAggregation) PostAggregation

func PostAggConstant Uses

func PostAggConstant(name string, value interface{}) PostAggregation

func PostAggFieldAccessor Uses

func PostAggFieldAccessor(fieldName string) PostAggregation

func PostAggFieldHyperUnique Uses

func PostAggFieldHyperUnique(fieldName string) PostAggregation

func PostAggJavaScript Uses

func PostAggJavaScript(name, function string, fieldNames []string) PostAggregation

func PostAggRawJson Uses

func PostAggRawJson(rawJson string) PostAggregation

func (PostAggregation) GetReferAggs Uses

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 Uses

type Query interface {
    GetRawJSON() []byte
    // contains filtered or unexported methods
}

The Query interface stands for any kinds of druid query.

type QueryGroupBy Uses

type QueryGroupBy struct {
    QueryType        QueryType              `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        Intervals              `json:"intervals"`
    Context          map[string]interface{} `json:"context,omitempty"`
    VirtualColumns   []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult      []GroupbyItem          `json:"-"`
    RawJSON          []byte
}

func (*QueryGroupBy) GetRawJSON Uses

func (q *QueryGroupBy) GetRawJSON() []byte

type QueryScan Uses

type QueryScan struct {
    QueryType      QueryType              `json:"queryType"`
    DataSource     string                 `json:"dataSource"`
    Limit          int                    `json:"limit,omitempty"`
    Columns        []string               `json:"columns,omitempty"`
    ResultFormat   string                 `json:"resultFormat,omitempty"`
    Metric         interface{}            `json:"metric"` // *TopNMetric
    Filter         *Filter                `json:"filter,omitempty"`
    Intervals      Intervals              `json:"intervals"`
    Context        map[string]interface{} `json:"context,omitempty"`
    VirtualColumns []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult    []ScanBlob             `json:"-"`
    RawJSON        []byte
}

func (*QueryScan) GetRawJSON Uses

func (q *QueryScan) GetRawJSON() []byte

type QuerySearch Uses

type QuerySearch struct {
    QueryType        QueryType              `json:"queryType"`
    DataSource       string                 `json:"dataSource"`
    Granularity      Granlarity             `json:"granularity"`
    Filter           *Filter                `json:"filter,omitempty"`
    Intervals        Intervals              `json:"intervals"`
    SearchDimensions []string               `json:"searchDimensions,omitempty"`
    Query            *SearchQuery           `json:"query"`
    Sort             *SearchSort            `json:"sort"`
    Context          map[string]interface{} `json:"context,omitempty"`
    VirtualColumns   []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult      []SearchItem           `json:"-"`
    RawJSON          []byte
}

func (*QuerySearch) GetRawJSON Uses

func (q *QuerySearch) GetRawJSON() []byte

type QuerySegmentMetadata Uses

type QuerySegmentMetadata struct {
    QueryType      QueryType              `json:"queryType"`
    DataSource     string                 `json:"dataSource"`
    Intervals      Intervals              `json:"intervals"`
    ToInclude      *ToInclude             `json:"toInclude,omitempty"`
    Merge          interface{}            `json:"merge,omitempty"`
    Context        map[string]interface{} `json:"context,omitempty"`
    VirtualColumns []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult    []SegmentMetaData      `json:"-"`
    RawJSON        []byte
}

func (*QuerySegmentMetadata) GetRawJSON Uses

func (q *QuerySegmentMetadata) GetRawJSON() []byte

type QuerySelect Uses

type QuerySelect struct {
    QueryType      QueryType              `json:"queryType"`
    DataSource     string                 `json:"dataSource"`
    Intervals      Intervals              `json:"intervals"`
    Filter         *Filter                `json:"filter,omitempty"`
    Dimensions     []DimSpec              `json:"dimensions"`
    Metrics        []string               `json:"metrics"`
    Granularity    Granlarity             `json:"granularity"`
    PagingSpec     map[string]interface{} `json:"pagingSpec,omitempty"`
    Context        map[string]interface{} `json:"context,omitempty"`
    VirtualColumns []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult    SelectBlob             `json:"-"`
    RawJSON        []byte
}

func (*QuerySelect) GetRawJSON Uses

func (q *QuerySelect) GetRawJSON() []byte

type QueryTimeBoundary Uses

type QueryTimeBoundary struct {
    QueryType  QueryType              `json:"queryType"`
    DataSource string                 `json:"dataSource"`
    Bound      string                 `json:"bound,omitempty"`
    Context    map[string]interface{} `json:"context,omitempty"`

    QueryResult []TimeBoundaryItem `json:"-"`
    RawJSON     []byte
}

func (*QueryTimeBoundary) GetRawJSON Uses

func (q *QueryTimeBoundary) GetRawJSON() []byte

type QueryTimeseries Uses

type QueryTimeseries struct {
    QueryType        QueryType              `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        Intervals              `json:"intervals"`
    Context          map[string]interface{} `json:"context,omitempty"`
    VirtualColumns   []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult      []Timeseries           `json:"-"`
    RawJSON          []byte
}

func (*QueryTimeseries) GetRawJSON Uses

func (q *QueryTimeseries) GetRawJSON() []byte

type QueryTopN Uses

type QueryTopN struct {
    QueryType        QueryType              `json:"queryType"`
    DataSource       string                 `json:"dataSource"`
    Granularity      Granlarity             `json:"granularity"`
    Dimension        DimSpec                `json:"dimension"`
    Threshold        int                    `json:"threshold"`
    Metric           interface{}            `json:"metric"` // *TopNMetric
    Filter           *Filter                `json:"filter,omitempty"`
    Aggregations     []Aggregation          `json:"aggregations"`
    PostAggregations []PostAggregation      `json:"postAggregations,omitempty"`
    Intervals        Intervals              `json:"intervals"`
    Context          map[string]interface{} `json:"context,omitempty"`
    VirtualColumns   []VirtualColumn        `json:"virtualColumns,omitempty"`
    QueryResult      []TopNItem             `json:"-"`
    RawJSON          []byte
}

func (*QueryTopN) GetRawJSON Uses

func (q *QueryTopN) GetRawJSON() []byte

type QueryType Uses

type QueryType string
const (
    TIMESERIES      QueryType = "timeseries"
    TOPN            QueryType = "topN"
    SEARCH          QueryType = "search"
    GROUPBY         QueryType = "groupBy"
    SEGMENTMETADATA QueryType = "segmentMetadata"
    TIMEBOUNDARY    QueryType = "timeBoundary"
    SELECT          QueryType = "select"
    SCAN            QueryType = "scan"
)

type RegisteredLookupExtractionFn Uses

type RegisteredLookupExtractionFn struct {
    Type   string `json:"type"`
    Lookup string `json:"lookup"`
}

type ScanBlob Uses

type ScanBlob struct {
    SegmentID string                   `json:"segmentId"`
    Columns   []string                 `json:"columns"`
    Events    []map[string]interface{} `json:"events"`
}

type SearchItem Uses

type SearchItem struct {
    Timestamp string     `json:"timestamp"`
    Result    []DimValue `json:"result"`
}

type SearchQuery Uses

type SearchQuery struct {
    Type   string        `json:"type"`
    Value  interface{}   `json:"value,omitempty"`
    Values []interface{} `json:"values,omitempty"`
}

func SearchQueryFragmentSearch Uses

func SearchQueryFragmentSearch(values []interface{}) *SearchQuery

func SearchQueryInsensitiveContains Uses

func SearchQueryInsensitiveContains(value interface{}) *SearchQuery

type SearchSort Uses

type SearchSort struct {
    Type string `json:"type"`
}

type SegmentMetaData Uses

type SegmentMetaData struct {
    Id        string                `json:"id"`
    Intervals Intervals             `json:"intervals"`
    Columns   map[string]ColumnItem `json:"columns"`
}

type SelectBlob Uses

type SelectBlob struct {
    Timestamp string       `json:"timestamp"`
    Result    SelectResult `json:"result"`
}

Select json blob from druid comes back as following: http://druid.io/docs/latest/querying/select-query.html the interesting results are in events blob which we call as 'SelectEvent'.

type SelectEvent Uses

type SelectEvent struct {
    SegmentId string                 `json:"segmentId"`
    Offset    int64                  `json:"offset"`
    Event     map[string]interface{} `json:"event"`
}

type SelectResult Uses

type SelectResult struct {
    PagingIdentifiers map[string]interface{} `json:"pagingIdentifiers"`
    Events            []SelectEvent          `json:"events"`
}

type SimpleGran Uses

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"
    GranWeek       SimpleGran = "week"
    GranMonth      SimpleGran = "month"
    GranQuarter    SimpleGran = "quarter"
    GranYear       SimpleGran = "year"
)

type TimeBoundary Uses

type TimeBoundary struct {
    MinTime string `json:"minTime"`
    MaxTime string `json:"maxTime"`
}

type TimeBoundaryItem Uses

type TimeBoundaryItem struct {
    Timestamp string       `json:"timestamp"`
    Result    TimeBoundary `json:"result"`
}

type TimeExtractionDimensionSpec Uses

type TimeExtractionDimensionSpec struct {
    Type               string       `json:"type"`
    Dimension          string       `json:"dimension"`
    OutputName         string       `json:"outputName"`
    ExtractionFunction ExtractionFn `json:"extractionFn"`
}

type TimeExtractionFn Uses

type TimeExtractionFn struct {
    Type     string `json:"type"`
    Format   string `json:"format"`
    TimeZone string `json:"timeZone"`
    Locale   string `json:"locale"`
}

type Timeseries Uses

type Timeseries struct {
    Timestamp string                 `json:"timestamp"`
    Result    map[string]interface{} `json:"result"`
}

type ToInclude Uses

type ToInclude struct {
    Type    string   `json:"type"`
    Columns []string `json:"columns,omitempty"`
}

func ToIncludeList Uses

func ToIncludeList(columns []string) *ToInclude

type TopNItem Uses

type TopNItem struct {
    Timestamp string                   `json:"timestamp"`
    Result    []map[string]interface{} `json:"result"`
}

type TopNMetric Uses

type TopNMetric struct {
    Type         string      `json:"type"`
    Metric       interface{} `json:"metric,omitempty"`
    PreviousStop string      `json:"previousStop"`
}

func TopNMetricAlphaNumeric Uses

func TopNMetricAlphaNumeric(previousStop string) *TopNMetric

func TopNMetricInverted Uses

func TopNMetricInverted(metric *TopNMetric) *TopNMetric

func TopNMetricLexicographic Uses

func TopNMetricLexicographic(previousStop string) *TopNMetric

func TopNMetricNumeric Uses

func TopNMetricNumeric(metric string) *TopNMetric

type VirtualColumn Uses

type VirtualColumn struct {
    Type       string                  `json:"type"`
    Name       string                  `json:"name"`
    Expression string                  `json:"expression"`
    OutputType VirtualColumnOutputType `json:"outputType"`
}

func NewVirtualColumn Uses

func NewVirtualColumn(name string, expression string, outputType VirtualColumnOutputType) VirtualColumn

type VirtualColumnOutputType Uses

type VirtualColumnOutputType string
const (
    VirtualColumnLong   VirtualColumnOutputType = "LONG"
    VirtualColumnFloat  VirtualColumnOutputType = "FLOAT"
    VirtualColumnDouble VirtualColumnOutputType = "DOUBLE"
    VirtualColumnString VirtualColumnOutputType = "STRING"
)

Package godruid imports 5 packages (graph). Updated 2019-08-04. Refresh now. Tools for package owners.