util

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NumericBucketTypeBucketWidth is a NumericBucketType
	NumericBucketTypeBucketWidth = "bucketWidth"
	// NumericBucketTypeLogBase is a NumericBucketType
	NumericBucketTypeLogBase = "logBase"
	// NumericBucketTypeManualPartitions is a NumericBucketType
	NumericBucketTypeManualPartitions = "manualPartitions"
)
View Source
const (
	// Timefilter is function type
	Timefilter funcType = iota
	// TimeNow is function type
	TimeNow
	// Timebucket is function type
	Timebucket
	// Numericbucket is function type
	Numericbucket
)

Variables

View Source
var AggregateFunctions = map[string]bool{
	"count": true,
	"sum":   true,
	"avg":   true,
	"max":   true,
	"min":   true,
	"hll":   true,
}

AggregateFunctions is a set of call names that are aggregate functions

View Source
var UdfTable = map[string]funcDef{

	"aql_time_filter": {Timefilter, 4, "timeFilter", []string{"column", "from", "to", "timezone"}},

	"aql_now": {TimeNow, 2, "now", []string{"column", "now"}},

	"aql_time_bucket_minute":          {Timebucket, 3, "minute", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_minutes":         {Timebucket, 3, "minutes", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_hour":            {Timebucket, 3, "hour", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_hours":           {Timebucket, 3, "hours", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_day":             {Timebucket, 3, "day", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_week":            {Timebucket, 3, "week", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_month":           {Timebucket, 3, "month", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_quarter":         {Timebucket, 3, "quarter", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_year":            {Timebucket, 3, "year", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_time_of_day":     {Timebucket, 3, "time of day", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_minutes_of_day":  {Timebucket, 3, "minutes of day", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_hour_of_day":     {Timebucket, 3, "hour of day", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_hour_of_week":    {Timebucket, 3, "hour of week", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_day_of_week":     {Timebucket, 3, "day of week", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_day_of_month":    {Timebucket, 3, "day of month", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_day_of_year":     {Timebucket, 3, "day of year", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_month_of_year":   {Timebucket, 3, "month of year", []string{"column", "timeunit", "timezone"}},
	"aql_time_bucket_quarter_of_year": {Timebucket, 3, "quarter of year", []string{"column", "timeunit", "timezone"}},

	"aql_numeric_bucket_bucket_width":       {Numericbucket, 2, "bucketWidth", []string{"column", "expression"}},
	"aql_numeric_bucket_logbase":            {Numericbucket, 2, "logBase", []string{"column", "expression"}},
	"aql_numeric_bucket_mannual_partitions": {Numericbucket, 2, "mannualPartitions", []string{"column", "expression"}},
}

UdfTable is function registration table. key: function name; value: function definition.

Functions

func GetSubstring

func GetSubstring(str string) string

GetSubstring returns substring embeded in a node's value (substring)

func RequireNonNull

func RequireNonNull(pointer interface{}, errMsg string)

RequireNonNull validate a point is not null

func TrimQuote

func TrimQuote(str string) string

TrimQuote remove leading and tail quote

Types

type CaseChangingStream

type CaseChangingStream struct {
	antlr.CharStream
	// contains filtered or unexported fields
}

CaseChangingStream wraps an existing CharStream, but upper cases, or lower cases the input before it is tokenized.

func NewCaseChangingStream

func NewCaseChangingStream(in antlr.CharStream, upper bool) *CaseChangingStream

NewCaseChangingStream returns a new CaseChangingStream that forces all tokens read from the underlying stream to be either upper case or lower case based on the upper argument.

func (*CaseChangingStream) LA

func (is *CaseChangingStream) LA(offset int) int

LA gets the value of the symbol at offset from the current position from the underlying CharStream and converts it to either upper case or lower case.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL