Documentation ¶
Overview ¶
Package influxql implements a parser for the InfluxDB query language.
InfluxQL is a DML and DDL language for the InfluxDB time series database. It provides the ability to query for aggregate statistics as well as create and configure the InfluxDB server.
See https://docs.influxdata.com/influxdb/latest/query_language/ for a reference on using InfluxQL.
Index ¶
- Constants
- Variables
- func AggregateBooleanPoints(a BooleanPointAggregator, points []BooleanPoint)
- func AggregateFloatPoints(a FloatPointAggregator, points []FloatPoint)
- func AggregateIntegerPoints(a IntegerPointAggregator, points []IntegerPoint)
- func AggregateStringPoints(a StringPointAggregator, points []StringPoint)
- func BinaryExprName(expr *BinaryExpr) string
- func BooleanCountReduce(prev *IntegerPoint, curr *BooleanPoint) (int64, int64, []interface{})
- func BooleanFirstReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
- func BooleanLastReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
- func BooleanMaxReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
- func BooleanMinReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
- func ContainsVarRef(expr Expr) bool
- func DrainIterator(itr Iterator)
- func DrainIterators(itrs []Iterator)
- func ErrDatabaseNotFound(name string) error
- func ErrMaxConcurrentQueriesLimitExceeded(n, limit int) error
- func ErrMaxSelectPointsLimitExceeded(n, limit int) error
- func ErrMeasurementNotFound(name string) error
- func Eval(expr Expr, m map[string]interface{}) interface{}
- func EvalBool(expr Expr, m map[string]interface{}) bool
- func FieldDimensions(sources Sources, m FieldMapper) (fields map[string]DataType, dimensions map[string]struct{}, err error)
- func FloatCountReduce(prev *IntegerPoint, curr *FloatPoint) (int64, int64, []interface{})
- func FloatFirstReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
- func FloatLastReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
- func FloatMaxReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
- func FloatMinReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
- func FloatSumReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
- func FormatDuration(d time.Duration) string
- func HasTimeExpr(expr Expr) bool
- func IdentNeedsQuotes(ident string) bool
- func IntegerCountReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IntegerFirstReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IntegerLastReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IntegerMaxReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IntegerMinReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IntegerSumReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
- func IsRegexOp(t Token) bool
- func IsSelector(expr Expr) bool
- func IsSystemName(name string) bool
- func MatchSource(sources Sources, name string) string
- func OnlyTimeExpr(expr Expr) bool
- func ParseDuration(s string) (time.Duration, error)
- func QuoteIdent(segments ...string) string
- func QuoteString(s string) string
- func Sanitize(query string) string
- func ScanBareIdent(r io.RuneScanner) string
- func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error)
- func ScanString(r io.RuneScanner) (string, error)
- func StringCountReduce(prev *IntegerPoint, curr *StringPoint) (int64, int64, []interface{})
- func StringFirstReduce(prev, curr *StringPoint) (int64, string, []interface{})
- func StringLastReduce(prev, curr *StringPoint) (int64, string, []interface{})
- func TimeRange(expr Expr) (min, max time.Time, err error)
- func TimeRangeAsEpochNano(expr Expr) (min, max int64, err error)
- func Walk(v Visitor, node Node)
- func WalkFunc(node Node, fn func(Node))
- type AlterRetentionPolicyStatement
- type AuxIterator
- type BinaryExpr
- type BooleanBulkPointAggregator
- type BooleanDistinctReducer
- type BooleanElapsedReducer
- type BooleanFuncFloatReducer
- type BooleanFuncIntegerReducer
- type BooleanFuncReducer
- type BooleanFuncStringReducer
- type BooleanIterator
- type BooleanLiteral
- type BooleanPoint
- type BooleanPointAggregator
- type BooleanPointDecoder
- type BooleanPointEmitter
- type BooleanPointEncoder
- type BooleanReduceFloatFunc
- type BooleanReduceFloatSliceFunc
- type BooleanReduceFunc
- type BooleanReduceIntegerFunc
- type BooleanReduceIntegerSliceFunc
- type BooleanReduceSliceFunc
- type BooleanReduceStringFunc
- type BooleanReduceStringSliceFunc
- type BooleanSampleReducer
- type BooleanSliceFuncFloatReducer
- type BooleanSliceFuncIntegerReducer
- type BooleanSliceFuncReducer
- type BooleanSliceFuncStringReducer
- type Call
- type CreateContinuousQueryStatement
- type CreateDatabaseStatement
- type CreateRetentionPolicyStatement
- type CreateSubscriptionStatement
- type CreateUserStatement
- type DataType
- type DeleteSeriesStatement
- type DeleteStatement
- type Dimension
- type Dimensions
- type Distinct
- type DropContinuousQueryStatement
- type DropDatabaseStatement
- type DropMeasurementStatement
- type DropRetentionPolicyStatement
- type DropSeriesStatement
- type DropShardStatement
- type DropSubscriptionStatement
- type DropUserStatement
- type DurationLiteral
- type Emitter
- type ExecutionContext
- type ExecutionOptions
- type ExecutionPrivilege
- type ExecutionPrivileges
- type Expr
- type Field
- type FieldMapper
- type Fields
- type FillOption
- type FloatBulkPointAggregator
- type FloatCumulativeSumReducer
- type FloatDerivativeReducer
- type FloatDifferenceReducer
- type FloatDistinctReducer
- type FloatElapsedReducer
- type FloatFuncBooleanReducer
- type FloatFuncIntegerReducer
- type FloatFuncReducer
- type FloatFuncStringReducer
- type FloatHoltWintersReducer
- type FloatIterator
- type FloatMeanReducer
- type FloatMovingAverageReducer
- type FloatPoint
- func FloatMedianReduceSlice(a []FloatPoint) []FloatPoint
- func FloatModeReduceSlice(a []FloatPoint) []FloatPoint
- func FloatSpreadReduceSlice(a []FloatPoint) []FloatPoint
- func FloatStddevReduceSlice(a []FloatPoint) []FloatPoint
- func IntegerMedianReduceSlice(a []IntegerPoint) []FloatPoint
- func IntegerStddevReduceSlice(a []IntegerPoint) []FloatPoint
- type FloatPointAggregator
- type FloatPointDecoder
- type FloatPointEmitter
- type FloatPointEncoder
- type FloatReduceBooleanFunc
- type FloatReduceBooleanSliceFunc
- type FloatReduceFunc
- type FloatReduceIntegerFunc
- type FloatReduceIntegerSliceFunc
- type FloatReduceSliceFunc
- type FloatReduceStringFunc
- type FloatReduceStringSliceFunc
- type FloatSampleReducer
- type FloatSliceFuncBooleanReducer
- type FloatSliceFuncIntegerReducer
- type FloatSliceFuncReducer
- type FloatSliceFuncStringReducer
- type GrantAdminStatement
- type GrantStatement
- type HasDefaultDatabase
- type IntegerBulkPointAggregator
- type IntegerCumulativeSumReducer
- type IntegerDerivativeReducer
- type IntegerDifferenceReducer
- type IntegerDistinctReducer
- type IntegerElapsedReducer
- type IntegerFuncBooleanReducer
- type IntegerFuncFloatReducer
- type IntegerFuncReducer
- type IntegerFuncStringReducer
- type IntegerIterator
- type IntegerLiteral
- type IntegerMeanReducer
- type IntegerMovingAverageReducer
- type IntegerPoint
- type IntegerPointAggregator
- type IntegerPointDecoder
- type IntegerPointEmitter
- type IntegerPointEncoder
- type IntegerReduceBooleanFunc
- type IntegerReduceBooleanSliceFunc
- type IntegerReduceFloatFunc
- type IntegerReduceFloatSliceFunc
- type IntegerReduceFunc
- type IntegerReduceSliceFunc
- type IntegerReduceStringFunc
- type IntegerReduceStringSliceFunc
- type IntegerSampleReducer
- type IntegerSliceFuncBooleanReducer
- type IntegerSliceFuncFloatReducer
- type IntegerSliceFuncReducer
- type IntegerSliceFuncStringReducer
- type Interval
- type Iterator
- func NewCallIterator(input Iterator, opt IteratorOptions) (Iterator, error)
- func NewCloseInterruptIterator(input Iterator, closing <-chan struct{}) Iterator
- func NewDedupeIterator(input Iterator) Iterator
- func NewDistinctIterator(input Iterator, opt IteratorOptions) (Iterator, error)
- func NewFillIterator(input Iterator, expr Expr, opt IteratorOptions) Iterator
- func NewFilterIterator(input Iterator, cond Expr, opt IteratorOptions) Iterator
- func NewInterruptIterator(input Iterator, closing <-chan struct{}) Iterator
- func NewIntervalIterator(input Iterator, opt IteratorOptions) Iterator
- func NewIteratorMapper(itrs []Iterator, fields []int, opt IteratorOptions) Iterator
- func NewLimitIterator(input Iterator, opt IteratorOptions) Iterator
- func NewMedianIterator(input Iterator, opt IteratorOptions) (Iterator, error)
- func NewMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator
- func NewModeIterator(input Iterator, opt IteratorOptions) (Iterator, error)
- func NewParallelMergeIterator(inputs []Iterator, opt IteratorOptions, parallelism int) Iterator
- func NewReaderIterator(r io.Reader, typ DataType, stats IteratorStats) Iterator
- func NewSampleIterator(input Iterator, opt IteratorOptions, size int) (Iterator, error)
- func NewSortedMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator
- func Select(stmt *SelectStatement, ic IteratorCreator, sopt *SelectOptions) ([]Iterator, error)
- type IteratorCreator
- type IteratorEncoder
- type IteratorOptions
- func (opt IteratorOptions) DerivativeInterval() Interval
- func (opt IteratorOptions) ElapsedInterval() Interval
- func (opt IteratorOptions) GetDimensions() []string
- func (opt *IteratorOptions) MarshalBinary() ([]byte, error)
- func (opt IteratorOptions) MergeSorted() bool
- func (opt IteratorOptions) SeekTime() int64
- func (opt *IteratorOptions) UnmarshalBinary(buf []byte) error
- func (opt IteratorOptions) Window(t int64) (start, end int64)
- type IteratorStats
- type Iterators
- type KillQueryStatement
- type ListLiteral
- type Literal
- type Measurement
- type Measurements
- type Message
- type Node
- type NowValuer
- type NumberLiteral
- type ParenExpr
- type ParseError
- type Parser
- type Point
- type PointDecoder
- type Points
- type Pos
- type Privilege
- type Query
- type QueryExecutor
- type QueryInfo
- type QueryMonitorFunc
- type QueryStatistics
- type QueryTask
- type RegexLiteral
- type Result
- type RevokeAdminStatement
- type RevokeStatement
- type Rewriter
- type Scanner
- type SelectOptions
- type SelectStatement
- func (s *SelectStatement) Clone() *SelectStatement
- func (s *SelectStatement) ColumnNames() []string
- func (s *SelectStatement) FieldExprByName(name string) (int, Expr)
- func (s *SelectStatement) FunctionCalls() []*Call
- func (s *SelectStatement) FunctionCallsByPosition() [][]*Call
- func (s *SelectStatement) GroupByInterval() (time.Duration, error)
- func (s *SelectStatement) GroupByOffset() (time.Duration, error)
- func (s *SelectStatement) HasDerivative() bool
- func (s *SelectStatement) HasDimensionWildcard() bool
- func (s *SelectStatement) HasDistinct() bool
- func (s *SelectStatement) HasFieldWildcard() (hasWildcard bool)
- func (s *SelectStatement) HasSelector() bool
- func (s *SelectStatement) HasTimeFieldSpecified() bool
- func (s *SelectStatement) HasWildcard() bool
- func (s *SelectStatement) IsSimpleDerivative() bool
- func (s *SelectStatement) NamesInDimension() []string
- func (s *SelectStatement) NamesInSelect() []string
- func (s *SelectStatement) NamesInWhere() []string
- func (s *SelectStatement) Reduce(valuer Valuer) *SelectStatement
- func (s *SelectStatement) RequiredPrivileges() (ExecutionPrivileges, error)
- func (s *SelectStatement) RewriteDistinct()
- func (s *SelectStatement) RewriteFields(m FieldMapper) (*SelectStatement, error)
- func (s *SelectStatement) RewriteRegexConditions()
- func (s *SelectStatement) RewriteTimeCondition(now time.Time) error
- func (s *SelectStatement) RewriteTimeFields()
- func (s *SelectStatement) SetTimeRange(start, end time.Time) error
- func (s *SelectStatement) String() string
- func (s *SelectStatement) TimeAscending() bool
- func (s *SelectStatement) TimeFieldName() string
- type SetPasswordUserStatement
- type ShowContinuousQueriesStatement
- type ShowDatabasesStatement
- type ShowDiagnosticsStatement
- type ShowFieldKeysStatement
- type ShowGrantsForUserStatement
- type ShowMeasurementsStatement
- type ShowQueriesStatement
- type ShowRetentionPoliciesStatement
- type ShowSeriesStatement
- type ShowShardGroupsStatement
- type ShowShardsStatement
- type ShowStatsStatement
- type ShowSubscriptionsStatement
- type ShowTagKeysStatement
- type ShowTagValuesStatement
- type ShowUsersStatement
- type SortField
- type SortFields
- type Source
- type Sources
- func (a Sources) Filter(database, retentionPolicy string) []Source
- func (a Sources) HasRegex() bool
- func (a Sources) HasSystemSource() bool
- func (a Sources) MarshalBinary() ([]byte, error)
- func (a Sources) Measurements() []*Measurement
- func (a Sources) Names() []string
- func (a Sources) String() string
- func (a *Sources) UnmarshalBinary(buf []byte) error
- type Statement
- type StatementExecutor
- type StatementNormalizer
- type Statements
- type StringBulkPointAggregator
- type StringDistinctReducer
- type StringElapsedReducer
- type StringFuncBooleanReducer
- type StringFuncFloatReducer
- type StringFuncIntegerReducer
- type StringFuncReducer
- type StringIterator
- type StringLiteral
- type StringPoint
- type StringPointAggregator
- type StringPointDecoder
- type StringPointEmitter
- type StringPointEncoder
- type StringReduceBooleanFunc
- type StringReduceBooleanSliceFunc
- type StringReduceFloatFunc
- type StringReduceFloatSliceFunc
- type StringReduceFunc
- type StringReduceIntegerFunc
- type StringReduceIntegerSliceFunc
- type StringReduceSliceFunc
- type StringSampleReducer
- type StringSliceFuncBooleanReducer
- type StringSliceFuncFloatReducer
- type StringSliceFuncIntegerReducer
- type StringSliceFuncReducer
- type SubQuery
- type TagSet
- type Tags
- type Target
- type TaskManager
- func (t *TaskManager) AttachQuery(q *Query, database string, interrupt <-chan struct{}) (uint64, *QueryTask, error)
- func (t *TaskManager) Close() error
- func (t *TaskManager) ExecuteStatement(stmt Statement, ctx ExecutionContext) error
- func (t *TaskManager) KillQuery(qid uint64) error
- func (t *TaskManager) Queries() []QueryInfo
- type TimeLiteral
- type Token
- type TypeMapper
- type Valuer
- type VarRef
- type VarRefs
- type Visitor
- type Wildcard
Constants ¶
const ( // Unknown primitive data type. Unknown DataType = 0 // Float means the data type is a float. Float = 1 // Integer means the data type is an integer. Integer = 2 // String means the data type is a string of text. String = 3 // Boolean means the data type is a boolean. Boolean = 4 // Time means the data type is a time. Time = 5 // Duration means the data type is a duration of time. Duration = 6 // Tag means the data type is a tag. Tag = 7 // AnyField means the data type is any field. AnyField = 8 )
const ( // MinTime is used as the minimum time value when computing an unbounded range. // This time is one less than the MinNanoTime so that the first minimum // time can be used as a sentinel value to signify that it is the default // value rather than explicitly set by the user. MinTime = models.MinNanoTime - 1 // MaxTime is used as the maximum time value when computing an unbounded range. // This time is 2262-04-11 23:47:16.854775806 +0000 UTC MaxTime = models.MaxNanoTime )
const ( // DateFormat represents the format for date literals. DateFormat = "2006-01-02" // DateTimeFormat represents the format for date time literals. DateTimeFormat = "2006-01-02 15:04:05.999999" )
const ( // DefaultQueryTimeout is the default timeout for executing a query. // A value of zero will have no query timeout. DefaultQueryTimeout = time.Duration(0) )
const DefaultStatsInterval = 10 * time.Second
DefaultStatsInterval is the default value for IteratorEncoder.StatsInterval.
const (
// WarningLevel is the message level for a warning.
WarningLevel = "warning"
)
const ZeroTime = int64(math.MinInt64)
ZeroTime is the Unix nanosecond timestamp for no time. This time is not used by the query engine or the storage engine as a valid time.
Variables ¶
var ( // ErrInvalidQuery is returned when executing an unknown query type. ErrInvalidQuery = errors.New("invalid query") // ErrNotExecuted is returned when a statement is not executed in a query. // This can occur when a previous statement in the same query has errored. ErrNotExecuted = errors.New("not executed") // ErrQueryInterrupted is an error returned when the query is interrupted. ErrQueryInterrupted = errors.New("query interrupted") // ErrQueryAborted is an error returned when the query is aborted. ErrQueryAborted = errors.New("query aborted") // ErrQueryEngineShutdown is an error sent when the query cannot be // created because the query engine was shutdown. ErrQueryEngineShutdown = errors.New("query engine shutdown") // ErrQueryTimeoutLimitExceeded is an error when a query hits the max time allowed to run. ErrQueryTimeoutLimitExceeded = errors.New("query-timeout limit exceeded") )
var ErrInvalidDuration = errors.New("invalid duration")
ErrInvalidDuration is returned when parsing a malformed duration.
var ( // ErrInvalidTime is returned when the timestamp string used to // compare against time field is invalid. ErrInvalidTime = errors.New("invalid timestamp string") )
var ErrUnknownCall = errors.New("unknown call")
ErrUnknownCall is returned when operating on an unknown function call.
Functions ¶
func AggregateBooleanPoints ¶ added in v0.11.0
func AggregateBooleanPoints(a BooleanPointAggregator, points []BooleanPoint)
AggregateBooleanPoints feeds a slice of BooleanPoint into an aggregator. If the aggregator is a BooleanBulkPointAggregator, it will use the AggregateBulk method.
func AggregateFloatPoints ¶ added in v0.11.0
func AggregateFloatPoints(a FloatPointAggregator, points []FloatPoint)
AggregateFloatPoints feeds a slice of FloatPoint into an aggregator. If the aggregator is a FloatBulkPointAggregator, it will use the AggregateBulk method.
func AggregateIntegerPoints ¶ added in v0.11.0
func AggregateIntegerPoints(a IntegerPointAggregator, points []IntegerPoint)
AggregateIntegerPoints feeds a slice of IntegerPoint into an aggregator. If the aggregator is a IntegerBulkPointAggregator, it will use the AggregateBulk method.
func AggregateStringPoints ¶ added in v0.11.0
func AggregateStringPoints(a StringPointAggregator, points []StringPoint)
AggregateStringPoints feeds a slice of StringPoint into an aggregator. If the aggregator is a StringBulkPointAggregator, it will use the AggregateBulk method.
func BinaryExprName ¶ added in v0.11.0
func BinaryExprName(expr *BinaryExpr) string
BinaryExprName returns the name of a binary expression by concatenating the variables in the binary expression with underscores.
func BooleanCountReduce ¶ added in v0.11.0
func BooleanCountReduce(prev *IntegerPoint, curr *BooleanPoint) (int64, int64, []interface{})
BooleanCountReduce returns the count of points.
func BooleanFirstReduce ¶ added in v0.11.0
func BooleanFirstReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
BooleanFirstReduce returns the first point sorted by time.
func BooleanLastReduce ¶ added in v0.11.0
func BooleanLastReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
BooleanLastReduce returns the first point sorted by time.
func BooleanMaxReduce ¶ added in v1.0.0
func BooleanMaxReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
BooleanMaxReduce returns the minimum value between prev & curr.
func BooleanMinReduce ¶ added in v1.0.0
func BooleanMinReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})
BooleanMinReduce returns the minimum value between prev & curr.
func ContainsVarRef ¶ added in v0.11.0
ContainsVarRef returns true if expr is a VarRef or contains one.
func DrainIterator ¶ added in v1.0.0
func DrainIterator(itr Iterator)
DrainIterator reads and discards all points from itr.
func DrainIterators ¶ added in v1.0.0
func DrainIterators(itrs []Iterator)
DrainIterators reads and discards all points from itrs.
func ErrDatabaseNotFound ¶ added in v0.11.0
ErrDatabaseNotFound returns a database not found error for the given database name.
func ErrMaxConcurrentQueriesLimitExceeded ¶ added in v1.1.1
ErrMaxConcurrentQueriesLimitExceeded is an error when a query cannot be run because the maximum number of queries has been reached.
func ErrMaxSelectPointsLimitExceeded ¶ added in v1.1.1
ErrMaxSelectPointsLimitExceeded is an error when a query hits the maximum number of points.
func ErrMeasurementNotFound ¶ added in v0.11.0
ErrMeasurementNotFound returns a measurement not found error for the given measurement name.
func EvalBool ¶ added in v0.9.5
EvalBool evaluates expr and returns true if result is a boolean true. Otherwise returns false.
func FieldDimensions ¶ added in v1.2.1
func FloatCountReduce ¶ added in v0.11.0
func FloatCountReduce(prev *IntegerPoint, curr *FloatPoint) (int64, int64, []interface{})
FloatCountReduce returns the count of points.
func FloatFirstReduce ¶ added in v0.11.0
func FloatFirstReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
FloatFirstReduce returns the first point sorted by time.
func FloatLastReduce ¶ added in v0.11.0
func FloatLastReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
FloatLastReduce returns the last point sorted by time.
func FloatMaxReduce ¶ added in v0.11.0
func FloatMaxReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
FloatMaxReduce returns the maximum value between prev & curr.
func FloatMinReduce ¶ added in v0.11.0
func FloatMinReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
FloatMinReduce returns the minimum value between prev & curr.
func FloatSumReduce ¶ added in v0.11.0
func FloatSumReduce(prev, curr *FloatPoint) (int64, float64, []interface{})
FloatSumReduce returns the sum prev value & curr value.
func FormatDuration ¶
FormatDuration formats a duration to a string.
func HasTimeExpr ¶ added in v0.9.5
HasTimeExpr returns true if the expression has a time term.
func IdentNeedsQuotes ¶
IdentNeedsQuotes returns true if the ident string given would require quotes.
func IntegerCountReduce ¶ added in v0.11.0
func IntegerCountReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerCountReduce returns the count of points.
func IntegerFirstReduce ¶ added in v0.11.0
func IntegerFirstReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerFirstReduce returns the first point sorted by time.
func IntegerLastReduce ¶ added in v0.11.0
func IntegerLastReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerLastReduce returns the last point sorted by time.
func IntegerMaxReduce ¶ added in v0.11.0
func IntegerMaxReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerMaxReduce returns the maximum value between prev & curr.
func IntegerMinReduce ¶ added in v0.11.0
func IntegerMinReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerMinReduce returns the minimum value between prev & curr.
func IntegerSumReduce ¶ added in v0.11.0
func IntegerSumReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})
IntegerSumReduce returns the sum prev value & curr value.
func IsSelector ¶ added in v1.2.1
func IsSystemName ¶ added in v0.11.0
IsSystemName returns true if name is an internal system name.
func MatchSource ¶
MatchSource returns the source name that matches a field name. It returns a blank string if no sources match.
func OnlyTimeExpr ¶ added in v0.9.5
OnlyTimeExpr returns true if the expression only has time constraints.
func ParseDuration ¶
ParseDuration parses a time duration from a string. This is needed instead of time.ParseDuration because this will support the full syntax that InfluxQL supports for specifying durations including weeks and days.
func QuoteIdent ¶
QuoteIdent returns a quoted identifier from multiple bare identifiers.
func Sanitize ¶ added in v1.0.0
Sanitize attempts to sanitize passwords out of a raw query. It looks for patterns that may be related to the SET PASSWORD and CREATE USER statements and will redact the password that should be there. It will attempt to redact information from common invalid queries too, but it's not guaranteed to succeed on improper queries.
This function works on the raw query and attempts to retain the original input as much as possible.
func ScanBareIdent ¶
func ScanBareIdent(r io.RuneScanner) string
ScanBareIdent reads bare identifier from a rune reader.
func ScanDelimited ¶
func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error)
ScanDelimited reads a delimited set of runes
func ScanString ¶
func ScanString(r io.RuneScanner) (string, error)
ScanString reads a quoted string from a rune reader.
func StringCountReduce ¶ added in v0.11.0
func StringCountReduce(prev *IntegerPoint, curr *StringPoint) (int64, int64, []interface{})
StringCountReduce returns the count of points.
func StringFirstReduce ¶ added in v0.11.0
func StringFirstReduce(prev, curr *StringPoint) (int64, string, []interface{})
StringFirstReduce returns the first point sorted by time.
func StringLastReduce ¶ added in v0.11.0
func StringLastReduce(prev, curr *StringPoint) (int64, string, []interface{})
StringLastReduce returns the first point sorted by time.
func TimeRange ¶
TimeRange returns the minimum and maximum times specified by an expression. It returns zero times if there is no bound.
func TimeRangeAsEpochNano ¶ added in v0.9.2
TimeRangeAsEpochNano returns the minimum and maximum times, as epoch nano, specified by an expression. If there is no lower bound, the minimum time is returned for minimum. If there is no higher bound, now is returned for maximum.
Types ¶
type AlterRetentionPolicyStatement ¶
type AlterRetentionPolicyStatement struct { // Name of policy to alter. Name string // Name of the database this policy belongs to. Database string // Duration data written to this policy will be retained. Duration *time.Duration // Replication factor for data written to this policy. Replication *int // Should this policy be set as defalut for the database? Default bool // Duration of the Shard. ShardGroupDuration *time.Duration }
AlterRetentionPolicyStatement represents a command to alter an existing retention policy.
func (*AlterRetentionPolicyStatement) RequiredPrivileges ¶
func (s *AlterRetentionPolicyStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute an AlterRetentionPolicyStatement.
func (*AlterRetentionPolicyStatement) String ¶
func (s *AlterRetentionPolicyStatement) String() string
String returns a string representation of the alter retention policy statement.
type AuxIterator ¶ added in v0.11.0
type AuxIterator interface { Iterator // Auxilary iterator Iterator(name string, typ DataType) Iterator // Start starts writing to the created iterators. Start() // Backgrounds the iterator so that, when start is called, it will // continuously read from the iterator. Background() }
AuxIterator represents an iterator that can split off separate auxiliary iterators.
func NewAuxIterator ¶ added in v0.11.0
func NewAuxIterator(input Iterator, opt IteratorOptions) AuxIterator
NewAuxIterator returns a new instance of AuxIterator.
type BinaryExpr ¶
BinaryExpr represents an operation between two expressions.
func (*BinaryExpr) String ¶
func (e *BinaryExpr) String() string
String returns a string representation of the binary expression.
type BooleanBulkPointAggregator ¶ added in v0.11.0
type BooleanBulkPointAggregator interface {
AggregateBooleanBulk(points []BooleanPoint)
}
BooleanBulkPointAggregator aggregates multiple points at a time.
type BooleanDistinctReducer ¶ added in v1.0.0
type BooleanDistinctReducer struct {
// contains filtered or unexported fields
}
BooleanDistinctReducer returns the distinct points in a series.
func NewBooleanDistinctReducer ¶ added in v1.0.0
func NewBooleanDistinctReducer() *BooleanDistinctReducer
NewBooleanDistinctReducer creates a new BooleanDistinctReducer.
func (*BooleanDistinctReducer) AggregateBoolean ¶ added in v1.0.0
func (r *BooleanDistinctReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean aggregates a point into the reducer.
func (*BooleanDistinctReducer) Emit ¶ added in v1.0.0
func (r *BooleanDistinctReducer) Emit() []BooleanPoint
Emit emits the distinct points that have been aggregated into the reducer.
type BooleanElapsedReducer ¶ added in v1.0.0
type BooleanElapsedReducer struct {
// contains filtered or unexported fields
}
BooleanElapsedReducer calculates the elapsed of the aggregated points.
func NewBooleanElapsedReducer ¶ added in v1.0.0
func NewBooleanElapsedReducer(interval Interval) *BooleanElapsedReducer
NewBooleanElapsedReducer creates a new BooleanElapsedReducer.
func (*BooleanElapsedReducer) AggregateBoolean ¶ added in v1.0.0
func (r *BooleanElapsedReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean aggregates a point into the reducer and updates the current window.
func (*BooleanElapsedReducer) Emit ¶ added in v1.0.0
func (r *BooleanElapsedReducer) Emit() []IntegerPoint
Emit emits the elapsed of the reducer at the current point.
type BooleanFuncFloatReducer ¶ added in v0.11.0
type BooleanFuncFloatReducer struct {
// contains filtered or unexported fields
}
BooleanFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewBooleanFuncFloatReducer ¶ added in v0.11.0
func NewBooleanFuncFloatReducer(fn BooleanReduceFloatFunc, prev *FloatPoint) *BooleanFuncFloatReducer
NewBooleanFuncFloatReducer creates a new BooleanFuncFloatReducer.
func (*BooleanFuncFloatReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanFuncFloatReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.
func (*BooleanFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *BooleanFuncFloatReducer) Emit() []FloatPoint
Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.
type BooleanFuncIntegerReducer ¶ added in v0.11.0
type BooleanFuncIntegerReducer struct {
// contains filtered or unexported fields
}
BooleanFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewBooleanFuncIntegerReducer ¶ added in v0.11.0
func NewBooleanFuncIntegerReducer(fn BooleanReduceIntegerFunc, prev *IntegerPoint) *BooleanFuncIntegerReducer
NewBooleanFuncIntegerReducer creates a new BooleanFuncIntegerReducer.
func (*BooleanFuncIntegerReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanFuncIntegerReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.
func (*BooleanFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *BooleanFuncIntegerReducer) Emit() []IntegerPoint
Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.
type BooleanFuncReducer ¶ added in v0.11.0
type BooleanFuncReducer struct {
// contains filtered or unexported fields
}
BooleanFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewBooleanFuncReducer ¶ added in v0.11.0
func NewBooleanFuncReducer(fn BooleanReduceFunc, prev *BooleanPoint) *BooleanFuncReducer
NewBooleanFuncReducer creates a new BooleanFuncBooleanReducer.
func (*BooleanFuncReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanFuncReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.
func (*BooleanFuncReducer) Emit ¶ added in v0.11.0
func (r *BooleanFuncReducer) Emit() []BooleanPoint
Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.
type BooleanFuncStringReducer ¶ added in v0.11.0
type BooleanFuncStringReducer struct {
// contains filtered or unexported fields
}
BooleanFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewBooleanFuncStringReducer ¶ added in v0.11.0
func NewBooleanFuncStringReducer(fn BooleanReduceStringFunc, prev *StringPoint) *BooleanFuncStringReducer
NewBooleanFuncStringReducer creates a new BooleanFuncStringReducer.
func (*BooleanFuncStringReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanFuncStringReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.
func (*BooleanFuncStringReducer) Emit ¶ added in v0.11.0
func (r *BooleanFuncStringReducer) Emit() []StringPoint
Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.
type BooleanIterator ¶ added in v0.11.0
type BooleanIterator interface { Iterator Next() (*BooleanPoint, error) }
BooleanIterator represents a stream of boolean points.
type BooleanLiteral ¶
type BooleanLiteral struct {
Val bool
}
BooleanLiteral represents a boolean literal.
func (*BooleanLiteral) String ¶
func (l *BooleanLiteral) String() string
String returns a string representation of the literal.
type BooleanPoint ¶ added in v0.11.0
type BooleanPoint struct { Name string Tags Tags Time int64 Nil bool Value bool Aux []interface{} // Total number of points that were combined into this point from an aggregate. // If this is zero, the point is not the result of an aggregate function. Aggregated uint32 }
BooleanPoint represents a point with a bool value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.
func BooleanModeReduceSlice ¶ added in v1.0.0
func BooleanModeReduceSlice(a []BooleanPoint) []BooleanPoint
BooleanModeReduceSlice returns the mode value within a window.
func (*BooleanPoint) Clone ¶ added in v0.11.0
func (v *BooleanPoint) Clone() *BooleanPoint
Clone returns a copy of v.
func (*BooleanPoint) CopyTo ¶ added in v1.2.1
func (v *BooleanPoint) CopyTo(other *BooleanPoint)
CopyTo makes a deep copy into the point.
type BooleanPointAggregator ¶ added in v0.11.0
type BooleanPointAggregator interface {
AggregateBoolean(p *BooleanPoint)
}
BooleanPointAggregator aggregates points to produce a single point.
type BooleanPointDecoder ¶ added in v0.11.0
type BooleanPointDecoder struct {
// contains filtered or unexported fields
}
BooleanPointDecoder decodes BooleanPoint points from a reader.
func NewBooleanPointDecoder ¶ added in v0.11.0
func NewBooleanPointDecoder(r io.Reader) *BooleanPointDecoder
NewBooleanPointDecoder returns a new instance of BooleanPointDecoder that reads from r.
func (*BooleanPointDecoder) DecodeBooleanPoint ¶ added in v0.11.0
func (dec *BooleanPointDecoder) DecodeBooleanPoint(p *BooleanPoint) error
DecodeBooleanPoint reads from the underlying reader and unmarshals into p.
func (*BooleanPointDecoder) Stats ¶ added in v0.12.0
func (dec *BooleanPointDecoder) Stats() IteratorStats
Stats returns iterator stats embedded within the stream.
type BooleanPointEmitter ¶ added in v0.11.0
type BooleanPointEmitter interface {
Emit() []BooleanPoint
}
BooleanPointEmitter produces a single point from an aggregate.
type BooleanPointEncoder ¶ added in v0.11.0
type BooleanPointEncoder struct {
// contains filtered or unexported fields
}
BooleanPointEncoder encodes BooleanPoint points to a writer.
func NewBooleanPointEncoder ¶ added in v0.11.0
func NewBooleanPointEncoder(w io.Writer) *BooleanPointEncoder
NewBooleanPointEncoder returns a new instance of BooleanPointEncoder that writes to w.
func (*BooleanPointEncoder) EncodeBooleanPoint ¶ added in v0.11.0
func (enc *BooleanPointEncoder) EncodeBooleanPoint(p *BooleanPoint) error
EncodeBooleanPoint marshals and writes p to the underlying writer.
type BooleanReduceFloatFunc ¶ added in v0.11.0
type BooleanReduceFloatFunc func(prev *FloatPoint, curr *BooleanPoint) (t int64, v float64, aux []interface{})
BooleanReduceFloatFunc is the function called by a BooleanPoint reducer.
type BooleanReduceFloatSliceFunc ¶ added in v0.11.0
type BooleanReduceFloatSliceFunc func(a []BooleanPoint) []FloatPoint
BooleanReduceFloatSliceFunc is the function called by a BooleanPoint reducer.
type BooleanReduceFunc ¶ added in v0.11.0
type BooleanReduceFunc func(prev *BooleanPoint, curr *BooleanPoint) (t int64, v bool, aux []interface{})
BooleanReduceFunc is the function called by a BooleanPoint reducer.
type BooleanReduceIntegerFunc ¶ added in v0.11.0
type BooleanReduceIntegerFunc func(prev *IntegerPoint, curr *BooleanPoint) (t int64, v int64, aux []interface{})
BooleanReduceIntegerFunc is the function called by a BooleanPoint reducer.
type BooleanReduceIntegerSliceFunc ¶ added in v0.11.0
type BooleanReduceIntegerSliceFunc func(a []BooleanPoint) []IntegerPoint
BooleanReduceIntegerSliceFunc is the function called by a BooleanPoint reducer.
type BooleanReduceSliceFunc ¶ added in v0.11.0
type BooleanReduceSliceFunc func(a []BooleanPoint) []BooleanPoint
BooleanReduceSliceFunc is the function called by a BooleanPoint reducer.
type BooleanReduceStringFunc ¶ added in v0.11.0
type BooleanReduceStringFunc func(prev *StringPoint, curr *BooleanPoint) (t int64, v string, aux []interface{})
BooleanReduceStringFunc is the function called by a BooleanPoint reducer.
type BooleanReduceStringSliceFunc ¶ added in v0.11.0
type BooleanReduceStringSliceFunc func(a []BooleanPoint) []StringPoint
BooleanReduceStringSliceFunc is the function called by a BooleanPoint reducer.
type BooleanSampleReducer ¶ added in v1.1.1
type BooleanSampleReducer struct {
// contains filtered or unexported fields
}
BooleanSampleReducer implements a reservoir sampling to calculate a random subset of points
func NewBooleanSampleReducer ¶ added in v1.1.1
func NewBooleanSampleReducer(size int) *BooleanSampleReducer
NewBooleanSampleReducer creates a new BooleanSampleReducer
func (*BooleanSampleReducer) AggregateBoolean ¶ added in v1.1.1
func (r *BooleanSampleReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean aggregates a point into the reducer.
func (*BooleanSampleReducer) Emit ¶ added in v1.1.1
func (r *BooleanSampleReducer) Emit() []BooleanPoint
Emit emits the reservoir sample as many points.
type BooleanSliceFuncFloatReducer ¶ added in v0.11.0
type BooleanSliceFuncFloatReducer struct {
// contains filtered or unexported fields
}
BooleanSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewBooleanSliceFuncFloatReducer ¶ added in v0.11.0
func NewBooleanSliceFuncFloatReducer(fn BooleanReduceFloatSliceFunc) *BooleanSliceFuncFloatReducer
NewBooleanSliceFuncFloatReducer creates a new BooleanSliceFuncFloatReducer.
func (*BooleanSliceFuncFloatReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanSliceFuncFloatReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*BooleanSliceFuncFloatReducer) AggregateBooleanBulk ¶ added in v0.11.0
func (r *BooleanSliceFuncFloatReducer) AggregateBooleanBulk(points []BooleanPoint)
AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.
func (*BooleanSliceFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *BooleanSliceFuncFloatReducer) Emit() []FloatPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type BooleanSliceFuncIntegerReducer ¶ added in v0.11.0
type BooleanSliceFuncIntegerReducer struct {
// contains filtered or unexported fields
}
BooleanSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewBooleanSliceFuncIntegerReducer ¶ added in v0.11.0
func NewBooleanSliceFuncIntegerReducer(fn BooleanReduceIntegerSliceFunc) *BooleanSliceFuncIntegerReducer
NewBooleanSliceFuncIntegerReducer creates a new BooleanSliceFuncIntegerReducer.
func (*BooleanSliceFuncIntegerReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanSliceFuncIntegerReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*BooleanSliceFuncIntegerReducer) AggregateBooleanBulk ¶ added in v0.11.0
func (r *BooleanSliceFuncIntegerReducer) AggregateBooleanBulk(points []BooleanPoint)
AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.
func (*BooleanSliceFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *BooleanSliceFuncIntegerReducer) Emit() []IntegerPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type BooleanSliceFuncReducer ¶ added in v0.11.0
type BooleanSliceFuncReducer struct {
// contains filtered or unexported fields
}
BooleanSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewBooleanSliceFuncReducer ¶ added in v0.11.0
func NewBooleanSliceFuncReducer(fn BooleanReduceSliceFunc) *BooleanSliceFuncReducer
NewBooleanSliceFuncReducer creates a new BooleanSliceFuncReducer.
func (*BooleanSliceFuncReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanSliceFuncReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*BooleanSliceFuncReducer) AggregateBooleanBulk ¶ added in v0.11.0
func (r *BooleanSliceFuncReducer) AggregateBooleanBulk(points []BooleanPoint)
AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.
func (*BooleanSliceFuncReducer) Emit ¶ added in v0.11.0
func (r *BooleanSliceFuncReducer) Emit() []BooleanPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type BooleanSliceFuncStringReducer ¶ added in v0.11.0
type BooleanSliceFuncStringReducer struct {
// contains filtered or unexported fields
}
BooleanSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewBooleanSliceFuncStringReducer ¶ added in v0.11.0
func NewBooleanSliceFuncStringReducer(fn BooleanReduceStringSliceFunc) *BooleanSliceFuncStringReducer
NewBooleanSliceFuncStringReducer creates a new BooleanSliceFuncStringReducer.
func (*BooleanSliceFuncStringReducer) AggregateBoolean ¶ added in v0.11.0
func (r *BooleanSliceFuncStringReducer) AggregateBoolean(p *BooleanPoint)
AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*BooleanSliceFuncStringReducer) AggregateBooleanBulk ¶ added in v0.11.0
func (r *BooleanSliceFuncStringReducer) AggregateBooleanBulk(points []BooleanPoint)
AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.
func (*BooleanSliceFuncStringReducer) Emit ¶ added in v0.11.0
func (r *BooleanSliceFuncStringReducer) Emit() []StringPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type CreateContinuousQueryStatement ¶
type CreateContinuousQueryStatement struct { // Name of the continuous query to be created. Name string // Name of the database to create the continuous query on. Database string // Source of data (SELECT statement). Source *SelectStatement // Interval to resample previous queries. ResampleEvery time.Duration // Maximum duration to resample previous queries. ResampleFor time.Duration }
CreateContinuousQueryStatement represents a command for creating a continuous query.
func (*CreateContinuousQueryStatement) DefaultDatabase ¶
func (s *CreateContinuousQueryStatement) DefaultDatabase() string
DefaultDatabase returns the default database from the statement.
func (*CreateContinuousQueryStatement) RequiredPrivileges ¶
func (s *CreateContinuousQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a CreateContinuousQueryStatement.
func (*CreateContinuousQueryStatement) String ¶
func (s *CreateContinuousQueryStatement) String() string
String returns a string representation of the statement.
type CreateDatabaseStatement ¶
type CreateDatabaseStatement struct { // Name of the database to be created. Name string // RetentionPolicyCreate indicates whether the user explicitly wants to create a retention policy. RetentionPolicyCreate bool // RetentionPolicyDuration indicates retention duration for the new database. RetentionPolicyDuration *time.Duration // RetentionPolicyReplication indicates retention replication for the new database. RetentionPolicyReplication *int // RetentionPolicyName indicates retention name for the new database. RetentionPolicyName string // RetentionPolicyShardGroupDuration indicates shard group duration for the new database. RetentionPolicyShardGroupDuration time.Duration }
CreateDatabaseStatement represents a command for creating a new database.
func (*CreateDatabaseStatement) RequiredPrivileges ¶
func (s *CreateDatabaseStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a CreateDatabaseStatement.
func (*CreateDatabaseStatement) String ¶
func (s *CreateDatabaseStatement) String() string
String returns a string representation of the create database statement.
type CreateRetentionPolicyStatement ¶
type CreateRetentionPolicyStatement struct { // Name of policy to create. Name string // Name of database this policy belongs to. Database string // Duration data written to this policy will be retained. Duration time.Duration // Replication factor for data written to this policy. Replication int // Should this policy be set as default for the database? Default bool // Shard Duration. ShardGroupDuration time.Duration }
CreateRetentionPolicyStatement represents a command to create a retention policy.
func (*CreateRetentionPolicyStatement) RequiredPrivileges ¶
func (s *CreateRetentionPolicyStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a CreateRetentionPolicyStatement.
func (*CreateRetentionPolicyStatement) String ¶
func (s *CreateRetentionPolicyStatement) String() string
String returns a string representation of the create retention policy.
type CreateSubscriptionStatement ¶ added in v0.9.5
type CreateSubscriptionStatement struct { Name string Database string RetentionPolicy string Destinations []string Mode string }
CreateSubscriptionStatement represents a command to add a subscription to the incoming data stream.
func (*CreateSubscriptionStatement) RequiredPrivileges ¶ added in v0.9.5
func (s *CreateSubscriptionStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a CreateSubscriptionStatement.
func (*CreateSubscriptionStatement) String ¶ added in v0.9.5
func (s *CreateSubscriptionStatement) String() string
String returns a string representation of the CreateSubscriptionStatement.
type CreateUserStatement ¶
type CreateUserStatement struct { // Name of the user to be created. Name string // User's password. Password string // User's admin privilege. Admin bool }
CreateUserStatement represents a command for creating a new user.
func (*CreateUserStatement) RequiredPrivileges ¶
func (s *CreateUserStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a CreateUserStatement.
func (*CreateUserStatement) String ¶
func (s *CreateUserStatement) String() string
String returns a string representation of the create user statement.
type DataType ¶
type DataType int
DataType represents the primitive data types available in InfluxQL.
func EvalType ¶ added in v1.2.1
func EvalType(expr Expr, sources Sources, typmap TypeMapper) DataType
EvalType evaluates the expression's type.
func InspectDataType ¶
func InspectDataType(v interface{}) DataType
InspectDataType returns the data type of a given value.
func InspectDataTypes ¶ added in v0.11.0
func InspectDataTypes(a []interface{}) []DataType
InspectDataTypes returns all of the data types for an interface slice.
type DeleteSeriesStatement ¶ added in v1.0.0
type DeleteSeriesStatement struct { // Data source that fields are extracted from (optional) Sources Sources // An expression evaluated on data point (optional) Condition Expr }
DeleteSeriesStatement represents a command for deleting all or part of a series from a database.
func (DeleteSeriesStatement) RequiredPrivileges ¶ added in v1.0.0
func (s DeleteSeriesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DeleteSeriesStatement.
func (*DeleteSeriesStatement) String ¶ added in v1.0.0
func (s *DeleteSeriesStatement) String() string
String returns a string representation of the delete series statement.
type DeleteStatement ¶
type DeleteStatement struct { // Data source that values are removed from. Source Source // An expression evaluated on data point. Condition Expr }
DeleteStatement represents a command for deleting data from the database.
func (*DeleteStatement) RequiredPrivileges ¶
func (s *DeleteStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DeleteStatement.
func (*DeleteStatement) String ¶
func (s *DeleteStatement) String() string
String returns a string representation of the delete statement.
type Dimension ¶
type Dimension struct {
Expr Expr
}
Dimension represents an expression that a select statement is grouped by.
type Dimensions ¶
type Dimensions []*Dimension
Dimensions represents a list of dimensions.
func (Dimensions) Normalize ¶
func (a Dimensions) Normalize() (time.Duration, []string)
Normalize returns the interval and tag dimensions separately. Returns 0 if no time interval is specified.
func (Dimensions) String ¶
func (a Dimensions) String() string
String returns a string representation of the dimensions.
type Distinct ¶
type Distinct struct { // Identifier following DISTINCT Val string }
Distinct represents a DISTINCT expression.
type DropContinuousQueryStatement ¶
DropContinuousQueryStatement represents a command for removing a continuous query.
func (*DropContinuousQueryStatement) RequiredPrivileges ¶
func (s *DropContinuousQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a DropContinuousQueryStatement
func (*DropContinuousQueryStatement) String ¶
func (s *DropContinuousQueryStatement) String() string
String returns a string representation of the statement.
type DropDatabaseStatement ¶
type DropDatabaseStatement struct { // Name of the database to be dropped. Name string }
DropDatabaseStatement represents a command to drop a database.
func (*DropDatabaseStatement) RequiredPrivileges ¶
func (s *DropDatabaseStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DropDatabaseStatement.
func (*DropDatabaseStatement) String ¶
func (s *DropDatabaseStatement) String() string
String returns a string representation of the drop database statement.
type DropMeasurementStatement ¶
type DropMeasurementStatement struct { // Name of the measurement to be dropped. Name string }
DropMeasurementStatement represents a command to drop a measurement.
func (*DropMeasurementStatement) RequiredPrivileges ¶
func (s *DropMeasurementStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a DropMeasurementStatement
func (*DropMeasurementStatement) String ¶
func (s *DropMeasurementStatement) String() string
String returns a string representation of the drop measurement statement.
type DropRetentionPolicyStatement ¶
type DropRetentionPolicyStatement struct { // Name of the policy to drop. Name string // Name of the database to drop the policy from. Database string }
DropRetentionPolicyStatement represents a command to drop a retention policy from a database.
func (*DropRetentionPolicyStatement) RequiredPrivileges ¶
func (s *DropRetentionPolicyStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DropRetentionPolicyStatement.
func (*DropRetentionPolicyStatement) String ¶
func (s *DropRetentionPolicyStatement) String() string
String returns a string representation of the drop retention policy statement.
type DropSeriesStatement ¶
type DropSeriesStatement struct { // Data source that fields are extracted from (optional) Sources Sources // An expression evaluated on data point (optional) Condition Expr }
DropSeriesStatement represents a command for removing a series from the database.
func (DropSeriesStatement) RequiredPrivileges ¶
func (s DropSeriesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DropSeriesStatement.
func (*DropSeriesStatement) String ¶
func (s *DropSeriesStatement) String() string
String returns a string representation of the drop series statement.
type DropShardStatement ¶ added in v0.12.0
type DropShardStatement struct { // ID of the shard to be dropped. ID uint64 }
DropShardStatement represents a command for removing a shard from the node.
func (*DropShardStatement) RequiredPrivileges ¶ added in v0.12.0
func (s *DropShardStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DropShardStatement.
func (*DropShardStatement) String ¶ added in v0.12.0
func (s *DropShardStatement) String() string
String returns a string representation of the drop series statement.
type DropSubscriptionStatement ¶ added in v0.9.5
DropSubscriptionStatement represents a command to drop a subscription to the incoming data stream.
func (*DropSubscriptionStatement) RequiredPrivileges ¶ added in v0.9.5
func (s *DropSubscriptionStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a DropSubscriptionStatement
func (*DropSubscriptionStatement) String ¶ added in v0.9.5
func (s *DropSubscriptionStatement) String() string
String returns a string representation of the DropSubscriptionStatement.
type DropUserStatement ¶
type DropUserStatement struct { // Name of the user to drop. Name string }
DropUserStatement represents a command for dropping a user.
func (*DropUserStatement) RequiredPrivileges ¶
func (s *DropUserStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a DropUserStatement.
func (*DropUserStatement) String ¶
func (s *DropUserStatement) String() string
String returns a string representation of the drop user statement.
type DurationLiteral ¶
DurationLiteral represents a duration literal.
func (*DurationLiteral) String ¶
func (l *DurationLiteral) String() string
String returns a string representation of the literal.
type Emitter ¶ added in v0.11.0
type Emitter struct { // The columns to attach to each row. Columns []string // Removes the "time" column from output. // Used for meta queries where time does not apply. OmitTime bool // contains filtered or unexported fields }
Emitter groups values together by name, tags, and time.
func NewEmitter ¶ added in v0.11.0
NewEmitter returns a new instance of Emitter that pulls from itrs.
type ExecutionContext ¶ added in v1.0.0
type ExecutionContext struct { // The statement ID of the executing query. StatementID int // The query ID of the executing query. QueryID uint64 // The query task information available to the StatementExecutor. Query *QueryTask // Output channel where results and errors should be sent. Results chan *Result // Hold the query executor's logger. Log zap.Logger // A channel that is closed when the query is interrupted. InterruptCh <-chan struct{} // Options used to start this query. ExecutionOptions }
ExecutionContext contains state that the query is currently executing with.
func (*ExecutionContext) Send ¶ added in v1.1.1
func (ctx *ExecutionContext) Send(result *Result) error
Send sends a Result to the Results channel and will exit if the query has been interrupted or aborted.
type ExecutionOptions ¶ added in v1.0.0
type ExecutionOptions struct { // The database the query is running against. Database string // The requested maximum number of points to return in each result. ChunkSize int // If this query is being executed in a read-only context. ReadOnly bool // Node to execute on. NodeID uint64 // Quiet suppresses non-essential output from the query executor. Quiet bool // AbortCh is a channel that signals when results are no longer desired by the caller. AbortCh <-chan struct{} }
ExecutionOptions contains the options for executing a query.
type ExecutionPrivilege ¶
type ExecutionPrivilege struct { // Admin privilege required. Admin bool // Name of the database. Name string // Database privilege required. Privilege Privilege }
ExecutionPrivilege is a privilege required for a user to execute a statement on a database or resource.
type ExecutionPrivileges ¶
type ExecutionPrivileges []ExecutionPrivilege
ExecutionPrivileges is a list of privileges required to execute a statement.
type Expr ¶
type Expr interface { Node // contains filtered or unexported methods }
Expr represents an expression that can be evaluated to a value.
func MustParseExpr ¶ added in v0.11.0
MustParseExpr parses an expression string and returns its AST. Panic on error.
type Field ¶
Field represents an expression retrieved from a select statement.
type FieldMapper ¶ added in v1.2.1
type FieldMapper interface { FieldDimensions(m *Measurement) (fields map[string]DataType, dimensions map[string]struct{}, err error) TypeMapper }
FieldMapper returns the data type for the field inside of the measurement.
type Fields ¶
type Fields []*Field
Fields represents a list of fields.
func (Fields) AliasNames ¶ added in v0.9.3
AliasNames returns a list of calculated field names in order of alias, function name, then field.
type FillOption ¶
type FillOption int
FillOption represents different options for filling aggregate windows.
const ( // NullFill means that empty aggregate windows will just have null values. NullFill FillOption = iota // NoFill means that empty aggregate windows will be purged from the result. NoFill // NumberFill means that empty aggregate windows will be filled with a provided number. NumberFill // PreviousFill means that empty aggregate windows will be filled with whatever the previous aggregate window had. PreviousFill // LinearFill means that empty aggregate windows will be filled with whatever a linear value between non null windows. LinearFill )
type FloatBulkPointAggregator ¶ added in v0.11.0
type FloatBulkPointAggregator interface {
AggregateFloatBulk(points []FloatPoint)
}
FloatBulkPointAggregator aggregates multiple points at a time.
type FloatCumulativeSumReducer ¶ added in v1.1.1
type FloatCumulativeSumReducer struct {
// contains filtered or unexported fields
}
FloatCumulativeSumReducer cumulates the values from each point.
func NewFloatCumulativeSumReducer ¶ added in v1.1.1
func NewFloatCumulativeSumReducer() *FloatCumulativeSumReducer
NewFloatCumulativeSumReducer creates a new FloatCumulativeSumReducer.
func (*FloatCumulativeSumReducer) AggregateFloat ¶ added in v1.1.1
func (r *FloatCumulativeSumReducer) AggregateFloat(p *FloatPoint)
func (*FloatCumulativeSumReducer) Emit ¶ added in v1.1.1
func (r *FloatCumulativeSumReducer) Emit() []FloatPoint
type FloatDerivativeReducer ¶ added in v1.0.0
type FloatDerivativeReducer struct {
// contains filtered or unexported fields
}
FloatDerivativeReducer calculates the derivative of the aggregated points.
func NewFloatDerivativeReducer ¶ added in v1.0.0
func NewFloatDerivativeReducer(interval Interval, isNonNegative, ascending bool) *FloatDerivativeReducer
NewFloatDerivativeReducer creates a new FloatDerivativeReducer.
func (*FloatDerivativeReducer) AggregateFloat ¶ added in v1.0.0
func (r *FloatDerivativeReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer and updates the current window.
func (*FloatDerivativeReducer) Emit ¶ added in v1.0.0
func (r *FloatDerivativeReducer) Emit() []FloatPoint
Emit emits the derivative of the reducer at the current point.
type FloatDifferenceReducer ¶ added in v1.0.0
type FloatDifferenceReducer struct {
// contains filtered or unexported fields
}
FloatDifferenceReducer calculates the derivative of the aggregated points.
func NewFloatDifferenceReducer ¶ added in v1.0.0
func NewFloatDifferenceReducer() *FloatDifferenceReducer
NewFloatDifferenceReducer creates a new FloatDifferenceReducer.
func (*FloatDifferenceReducer) AggregateFloat ¶ added in v1.0.0
func (r *FloatDifferenceReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer and updates the current window.
func (*FloatDifferenceReducer) Emit ¶ added in v1.0.0
func (r *FloatDifferenceReducer) Emit() []FloatPoint
Emit emits the difference of the reducer at the current point.
type FloatDistinctReducer ¶ added in v1.0.0
type FloatDistinctReducer struct {
// contains filtered or unexported fields
}
FloatDistinctReducer returns the distinct points in a series.
func NewFloatDistinctReducer ¶ added in v1.0.0
func NewFloatDistinctReducer() *FloatDistinctReducer
NewFloatDistinctReducer creates a new FloatDistinctReducer.
func (*FloatDistinctReducer) AggregateFloat ¶ added in v1.0.0
func (r *FloatDistinctReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer.
func (*FloatDistinctReducer) Emit ¶ added in v1.0.0
func (r *FloatDistinctReducer) Emit() []FloatPoint
Emit emits the distinct points that have been aggregated into the reducer.
type FloatElapsedReducer ¶ added in v1.0.0
type FloatElapsedReducer struct {
// contains filtered or unexported fields
}
FloatElapsedReducer calculates the elapsed of the aggregated points.
func NewFloatElapsedReducer ¶ added in v1.0.0
func NewFloatElapsedReducer(interval Interval) *FloatElapsedReducer
NewFloatElapsedReducer creates a new FloatElapsedReducer.
func (*FloatElapsedReducer) AggregateFloat ¶ added in v1.0.0
func (r *FloatElapsedReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer and updates the current window.
func (*FloatElapsedReducer) Emit ¶ added in v1.0.0
func (r *FloatElapsedReducer) Emit() []IntegerPoint
Emit emits the elapsed of the reducer at the current point.
type FloatFuncBooleanReducer ¶ added in v0.11.0
type FloatFuncBooleanReducer struct {
// contains filtered or unexported fields
}
FloatFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewFloatFuncBooleanReducer ¶ added in v0.11.0
func NewFloatFuncBooleanReducer(fn FloatReduceBooleanFunc, prev *BooleanPoint) *FloatFuncBooleanReducer
NewFloatFuncBooleanReducer creates a new FloatFuncBooleanReducer.
func (*FloatFuncBooleanReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatFuncBooleanReducer) AggregateFloat(p *FloatPoint)
AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.
func (*FloatFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *FloatFuncBooleanReducer) Emit() []BooleanPoint
Emit emits the point that was generated when reducing the points fed in with AggregateFloat.
type FloatFuncIntegerReducer ¶ added in v0.11.0
type FloatFuncIntegerReducer struct {
// contains filtered or unexported fields
}
FloatFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewFloatFuncIntegerReducer ¶ added in v0.11.0
func NewFloatFuncIntegerReducer(fn FloatReduceIntegerFunc, prev *IntegerPoint) *FloatFuncIntegerReducer
NewFloatFuncIntegerReducer creates a new FloatFuncIntegerReducer.
func (*FloatFuncIntegerReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatFuncIntegerReducer) AggregateFloat(p *FloatPoint)
AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.
func (*FloatFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *FloatFuncIntegerReducer) Emit() []IntegerPoint
Emit emits the point that was generated when reducing the points fed in with AggregateFloat.
type FloatFuncReducer ¶ added in v0.11.0
type FloatFuncReducer struct {
// contains filtered or unexported fields
}
FloatFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewFloatFuncReducer ¶ added in v0.11.0
func NewFloatFuncReducer(fn FloatReduceFunc, prev *FloatPoint) *FloatFuncReducer
NewFloatFuncReducer creates a new FloatFuncFloatReducer.
func (*FloatFuncReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatFuncReducer) AggregateFloat(p *FloatPoint)
AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.
func (*FloatFuncReducer) Emit ¶ added in v0.11.0
func (r *FloatFuncReducer) Emit() []FloatPoint
Emit emits the point that was generated when reducing the points fed in with AggregateFloat.
type FloatFuncStringReducer ¶ added in v0.11.0
type FloatFuncStringReducer struct {
// contains filtered or unexported fields
}
FloatFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewFloatFuncStringReducer ¶ added in v0.11.0
func NewFloatFuncStringReducer(fn FloatReduceStringFunc, prev *StringPoint) *FloatFuncStringReducer
NewFloatFuncStringReducer creates a new FloatFuncStringReducer.
func (*FloatFuncStringReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatFuncStringReducer) AggregateFloat(p *FloatPoint)
AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.
func (*FloatFuncStringReducer) Emit ¶ added in v0.11.0
func (r *FloatFuncStringReducer) Emit() []StringPoint
Emit emits the point that was generated when reducing the points fed in with AggregateFloat.
type FloatHoltWintersReducer ¶ added in v1.0.0
type FloatHoltWintersReducer struct {
// contains filtered or unexported fields
}
FloatHoltWintersReducer forecasts a series into the future. This is done using the Holt-Winters damped method.
- Using the series the initial values are calculated using a SSE.
- The series is forecasted into the future using the iterative relations.
func NewFloatHoltWintersReducer ¶ added in v1.0.0
func NewFloatHoltWintersReducer(h, m int, includeFitData bool, interval time.Duration) *FloatHoltWintersReducer
NewFloatHoltWintersReducer creates a new FloatHoltWintersReducer.
func (*FloatHoltWintersReducer) AggregateFloat ¶ added in v1.0.0
func (r *FloatHoltWintersReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer and updates the current window.
func (*FloatHoltWintersReducer) AggregateInteger ¶ added in v1.0.0
func (r *FloatHoltWintersReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer and updates the current window.
func (*FloatHoltWintersReducer) Emit ¶ added in v1.0.0
func (r *FloatHoltWintersReducer) Emit() []FloatPoint
Emit returns the points generated by the HoltWinters algorithm.
type FloatIterator ¶ added in v0.11.0
type FloatIterator interface { Iterator Next() (*FloatPoint, error) }
FloatIterator represents a stream of float points.
type FloatMeanReducer ¶ added in v0.11.0
type FloatMeanReducer struct {
// contains filtered or unexported fields
}
FloatMeanReducer calculates the mean of the aggregated points.
func NewFloatMeanReducer ¶ added in v0.11.0
func NewFloatMeanReducer() *FloatMeanReducer
NewFloatMeanReducer creates a new FloatMeanReducer.
func (*FloatMeanReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatMeanReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer.
func (*FloatMeanReducer) Emit ¶ added in v0.11.0
func (r *FloatMeanReducer) Emit() []FloatPoint
Emit emits the mean of the aggregated points as a single point.
type FloatMovingAverageReducer ¶ added in v0.12.0
type FloatMovingAverageReducer struct {
// contains filtered or unexported fields
}
FloatMovingAverageReducer calculates the moving average of the aggregated points.
func NewFloatMovingAverageReducer ¶ added in v0.12.0
func NewFloatMovingAverageReducer(n int) *FloatMovingAverageReducer
NewFloatMovingAverageReducer creates a new FloatMovingAverageReducer.
func (*FloatMovingAverageReducer) AggregateFloat ¶ added in v0.12.0
func (r *FloatMovingAverageReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer and updates the current window.
func (*FloatMovingAverageReducer) Emit ¶ added in v0.12.0
func (r *FloatMovingAverageReducer) Emit() []FloatPoint
Emit emits the moving average of the current window. Emit should be called after every call to AggregateFloat and it will produce one point if there is enough data to fill a window, otherwise it will produce zero points.
type FloatPoint ¶ added in v0.11.0
type FloatPoint struct { Name string Tags Tags Time int64 Nil bool Value float64 Aux []interface{} // Total number of points that were combined into this point from an aggregate. // If this is zero, the point is not the result of an aggregate function. Aggregated uint32 }
FloatPoint represents a point with a float64 value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.
func FloatMedianReduceSlice ¶ added in v0.11.0
func FloatMedianReduceSlice(a []FloatPoint) []FloatPoint
FloatMedianReduceSlice returns the median value within a window.
func FloatModeReduceSlice ¶ added in v1.0.0
func FloatModeReduceSlice(a []FloatPoint) []FloatPoint
FloatModeReduceSlice returns the mode value within a window.
func FloatSpreadReduceSlice ¶ added in v0.11.0
func FloatSpreadReduceSlice(a []FloatPoint) []FloatPoint
FloatSpreadReduceSlice returns the spread value within a window.
func FloatStddevReduceSlice ¶ added in v0.11.0
func FloatStddevReduceSlice(a []FloatPoint) []FloatPoint
FloatStddevReduceSlice returns the stddev value within a window.
func IntegerMedianReduceSlice ¶ added in v0.11.0
func IntegerMedianReduceSlice(a []IntegerPoint) []FloatPoint
IntegerMedianReduceSlice returns the median value within a window.
func IntegerStddevReduceSlice ¶ added in v0.11.0
func IntegerStddevReduceSlice(a []IntegerPoint) []FloatPoint
IntegerStddevReduceSlice returns the stddev value within a window.
func (*FloatPoint) Clone ¶ added in v0.11.0
func (v *FloatPoint) Clone() *FloatPoint
Clone returns a copy of v.
func (*FloatPoint) CopyTo ¶ added in v1.2.1
func (v *FloatPoint) CopyTo(other *FloatPoint)
CopyTo makes a deep copy into the point.
type FloatPointAggregator ¶ added in v0.11.0
type FloatPointAggregator interface {
AggregateFloat(p *FloatPoint)
}
FloatPointAggregator aggregates points to produce a single point.
type FloatPointDecoder ¶ added in v0.11.0
type FloatPointDecoder struct {
// contains filtered or unexported fields
}
FloatPointDecoder decodes FloatPoint points from a reader.
func NewFloatPointDecoder ¶ added in v0.11.0
func NewFloatPointDecoder(r io.Reader) *FloatPointDecoder
NewFloatPointDecoder returns a new instance of FloatPointDecoder that reads from r.
func (*FloatPointDecoder) DecodeFloatPoint ¶ added in v0.11.0
func (dec *FloatPointDecoder) DecodeFloatPoint(p *FloatPoint) error
DecodeFloatPoint reads from the underlying reader and unmarshals into p.
func (*FloatPointDecoder) Stats ¶ added in v0.12.0
func (dec *FloatPointDecoder) Stats() IteratorStats
Stats returns iterator stats embedded within the stream.
type FloatPointEmitter ¶ added in v0.11.0
type FloatPointEmitter interface {
Emit() []FloatPoint
}
FloatPointEmitter produces a single point from an aggregate.
type FloatPointEncoder ¶ added in v0.11.0
type FloatPointEncoder struct {
// contains filtered or unexported fields
}
FloatPointEncoder encodes FloatPoint points to a writer.
func NewFloatPointEncoder ¶ added in v0.11.0
func NewFloatPointEncoder(w io.Writer) *FloatPointEncoder
NewFloatPointEncoder returns a new instance of FloatPointEncoder that writes to w.
func (*FloatPointEncoder) EncodeFloatPoint ¶ added in v0.11.0
func (enc *FloatPointEncoder) EncodeFloatPoint(p *FloatPoint) error
EncodeFloatPoint marshals and writes p to the underlying writer.
type FloatReduceBooleanFunc ¶ added in v0.11.0
type FloatReduceBooleanFunc func(prev *BooleanPoint, curr *FloatPoint) (t int64, v bool, aux []interface{})
FloatReduceBooleanFunc is the function called by a FloatPoint reducer.
type FloatReduceBooleanSliceFunc ¶ added in v0.11.0
type FloatReduceBooleanSliceFunc func(a []FloatPoint) []BooleanPoint
FloatReduceBooleanSliceFunc is the function called by a FloatPoint reducer.
type FloatReduceFunc ¶ added in v0.11.0
type FloatReduceFunc func(prev *FloatPoint, curr *FloatPoint) (t int64, v float64, aux []interface{})
FloatReduceFunc is the function called by a FloatPoint reducer.
type FloatReduceIntegerFunc ¶ added in v0.11.0
type FloatReduceIntegerFunc func(prev *IntegerPoint, curr *FloatPoint) (t int64, v int64, aux []interface{})
FloatReduceIntegerFunc is the function called by a FloatPoint reducer.
type FloatReduceIntegerSliceFunc ¶ added in v0.11.0
type FloatReduceIntegerSliceFunc func(a []FloatPoint) []IntegerPoint
FloatReduceIntegerSliceFunc is the function called by a FloatPoint reducer.
type FloatReduceSliceFunc ¶ added in v0.11.0
type FloatReduceSliceFunc func(a []FloatPoint) []FloatPoint
FloatReduceSliceFunc is the function called by a FloatPoint reducer.
func NewFloatBottomReduceSliceFunc ¶ added in v0.11.0
func NewFloatBottomReduceSliceFunc(n int, tags []int, interval Interval) FloatReduceSliceFunc
NewFloatBottomReduceSliceFunc returns the bottom values within a window.
func NewFloatPercentileReduceSliceFunc ¶ added in v0.11.0
func NewFloatPercentileReduceSliceFunc(percentile float64) FloatReduceSliceFunc
NewFloatPercentileReduceSliceFunc returns the percentile value within a window.
func NewFloatTopReduceSliceFunc ¶ added in v0.11.0
func NewFloatTopReduceSliceFunc(n int, tags []int, interval Interval) FloatReduceSliceFunc
NewFloatTopReduceSliceFunc returns the top values within a window.
type FloatReduceStringFunc ¶ added in v0.11.0
type FloatReduceStringFunc func(prev *StringPoint, curr *FloatPoint) (t int64, v string, aux []interface{})
FloatReduceStringFunc is the function called by a FloatPoint reducer.
type FloatReduceStringSliceFunc ¶ added in v0.11.0
type FloatReduceStringSliceFunc func(a []FloatPoint) []StringPoint
FloatReduceStringSliceFunc is the function called by a FloatPoint reducer.
type FloatSampleReducer ¶ added in v1.1.1
type FloatSampleReducer struct {
// contains filtered or unexported fields
}
FloatSampleReducer implements a reservoir sampling to calculate a random subset of points
func NewFloatSampleReducer ¶ added in v1.1.1
func NewFloatSampleReducer(size int) *FloatSampleReducer
NewFloatSampleReducer creates a new FloatSampleReducer
func (*FloatSampleReducer) AggregateFloat ¶ added in v1.1.1
func (r *FloatSampleReducer) AggregateFloat(p *FloatPoint)
AggregateFloat aggregates a point into the reducer.
func (*FloatSampleReducer) Emit ¶ added in v1.1.1
func (r *FloatSampleReducer) Emit() []FloatPoint
Emit emits the reservoir sample as many points.
type FloatSliceFuncBooleanReducer ¶ added in v0.11.0
type FloatSliceFuncBooleanReducer struct {
// contains filtered or unexported fields
}
FloatSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewFloatSliceFuncBooleanReducer ¶ added in v0.11.0
func NewFloatSliceFuncBooleanReducer(fn FloatReduceBooleanSliceFunc) *FloatSliceFuncBooleanReducer
NewFloatSliceFuncBooleanReducer creates a new FloatSliceFuncBooleanReducer.
func (*FloatSliceFuncBooleanReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatSliceFuncBooleanReducer) AggregateFloat(p *FloatPoint)
AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*FloatSliceFuncBooleanReducer) AggregateFloatBulk ¶ added in v0.11.0
func (r *FloatSliceFuncBooleanReducer) AggregateFloatBulk(points []FloatPoint)
AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.
func (*FloatSliceFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *FloatSliceFuncBooleanReducer) Emit() []BooleanPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type FloatSliceFuncIntegerReducer ¶ added in v0.11.0
type FloatSliceFuncIntegerReducer struct {
// contains filtered or unexported fields
}
FloatSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewFloatSliceFuncIntegerReducer ¶ added in v0.11.0
func NewFloatSliceFuncIntegerReducer(fn FloatReduceIntegerSliceFunc) *FloatSliceFuncIntegerReducer
NewFloatSliceFuncIntegerReducer creates a new FloatSliceFuncIntegerReducer.
func (*FloatSliceFuncIntegerReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatSliceFuncIntegerReducer) AggregateFloat(p *FloatPoint)
AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*FloatSliceFuncIntegerReducer) AggregateFloatBulk ¶ added in v0.11.0
func (r *FloatSliceFuncIntegerReducer) AggregateFloatBulk(points []FloatPoint)
AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.
func (*FloatSliceFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *FloatSliceFuncIntegerReducer) Emit() []IntegerPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type FloatSliceFuncReducer ¶ added in v0.11.0
type FloatSliceFuncReducer struct {
// contains filtered or unexported fields
}
FloatSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewFloatSliceFuncReducer ¶ added in v0.11.0
func NewFloatSliceFuncReducer(fn FloatReduceSliceFunc) *FloatSliceFuncReducer
NewFloatSliceFuncReducer creates a new FloatSliceFuncReducer.
func (*FloatSliceFuncReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatSliceFuncReducer) AggregateFloat(p *FloatPoint)
AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*FloatSliceFuncReducer) AggregateFloatBulk ¶ added in v0.11.0
func (r *FloatSliceFuncReducer) AggregateFloatBulk(points []FloatPoint)
AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.
func (*FloatSliceFuncReducer) Emit ¶ added in v0.11.0
func (r *FloatSliceFuncReducer) Emit() []FloatPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type FloatSliceFuncStringReducer ¶ added in v0.11.0
type FloatSliceFuncStringReducer struct {
// contains filtered or unexported fields
}
FloatSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewFloatSliceFuncStringReducer ¶ added in v0.11.0
func NewFloatSliceFuncStringReducer(fn FloatReduceStringSliceFunc) *FloatSliceFuncStringReducer
NewFloatSliceFuncStringReducer creates a new FloatSliceFuncStringReducer.
func (*FloatSliceFuncStringReducer) AggregateFloat ¶ added in v0.11.0
func (r *FloatSliceFuncStringReducer) AggregateFloat(p *FloatPoint)
AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*FloatSliceFuncStringReducer) AggregateFloatBulk ¶ added in v0.11.0
func (r *FloatSliceFuncStringReducer) AggregateFloatBulk(points []FloatPoint)
AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.
func (*FloatSliceFuncStringReducer) Emit ¶ added in v0.11.0
func (r *FloatSliceFuncStringReducer) Emit() []StringPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type GrantAdminStatement ¶ added in v0.9.2
type GrantAdminStatement struct { // Who to grant the privilege to. User string }
GrantAdminStatement represents a command for granting admin privilege.
func (*GrantAdminStatement) RequiredPrivileges ¶ added in v0.9.2
func (s *GrantAdminStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a GrantAdminStatement.
func (*GrantAdminStatement) String ¶ added in v0.9.2
func (s *GrantAdminStatement) String() string
String returns a string representation of the grant admin statement.
type GrantStatement ¶
type GrantStatement struct { // The privilege to be granted. Privilege Privilege // Database to grant the privilege to. On string // Who to grant the privilege to. User string }
GrantStatement represents a command for granting a privilege.
func (*GrantStatement) RequiredPrivileges ¶
func (s *GrantStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a GrantStatement.
func (*GrantStatement) String ¶
func (s *GrantStatement) String() string
String returns a string representation of the grant statement.
type HasDefaultDatabase ¶
type HasDefaultDatabase interface { Node DefaultDatabase() string // contains filtered or unexported methods }
HasDefaultDatabase provides an interface to get the default database from a Statement.
type IntegerBulkPointAggregator ¶ added in v0.11.0
type IntegerBulkPointAggregator interface {
AggregateIntegerBulk(points []IntegerPoint)
}
IntegerBulkPointAggregator aggregates multiple points at a time.
type IntegerCumulativeSumReducer ¶ added in v1.1.1
type IntegerCumulativeSumReducer struct {
// contains filtered or unexported fields
}
IntegerCumulativeSumReducer cumulates the values from each point.
func NewIntegerCumulativeSumReducer ¶ added in v1.1.1
func NewIntegerCumulativeSumReducer() *IntegerCumulativeSumReducer
NewIntegerCumulativeSumReducer creates a new IntegerCumulativeSumReducer.
func (*IntegerCumulativeSumReducer) AggregateInteger ¶ added in v1.1.1
func (r *IntegerCumulativeSumReducer) AggregateInteger(p *IntegerPoint)
func (*IntegerCumulativeSumReducer) Emit ¶ added in v1.1.1
func (r *IntegerCumulativeSumReducer) Emit() []IntegerPoint
type IntegerDerivativeReducer ¶ added in v1.0.0
type IntegerDerivativeReducer struct {
// contains filtered or unexported fields
}
IntegerDerivativeReducer calculates the derivative of the aggregated points.
func NewIntegerDerivativeReducer ¶ added in v1.0.0
func NewIntegerDerivativeReducer(interval Interval, isNonNegative, ascending bool) *IntegerDerivativeReducer
NewIntegerDerivativeReducer creates a new IntegerDerivativeReducer.
func (*IntegerDerivativeReducer) AggregateInteger ¶ added in v1.0.0
func (r *IntegerDerivativeReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer and updates the current window.
func (*IntegerDerivativeReducer) Emit ¶ added in v1.0.0
func (r *IntegerDerivativeReducer) Emit() []FloatPoint
Emit emits the derivative of the reducer at the current point.
type IntegerDifferenceReducer ¶ added in v1.0.0
type IntegerDifferenceReducer struct {
// contains filtered or unexported fields
}
IntegerDifferenceReducer calculates the derivative of the aggregated points.
func NewIntegerDifferenceReducer ¶ added in v1.0.0
func NewIntegerDifferenceReducer() *IntegerDifferenceReducer
NewIntegerDifferenceReducer creates a new IntegerDifferenceReducer.
func (*IntegerDifferenceReducer) AggregateInteger ¶ added in v1.0.0
func (r *IntegerDifferenceReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer and updates the current window.
func (*IntegerDifferenceReducer) Emit ¶ added in v1.0.0
func (r *IntegerDifferenceReducer) Emit() []IntegerPoint
Emit emits the difference of the reducer at the current point.
type IntegerDistinctReducer ¶ added in v1.0.0
type IntegerDistinctReducer struct {
// contains filtered or unexported fields
}
IntegerDistinctReducer returns the distinct points in a series.
func NewIntegerDistinctReducer ¶ added in v1.0.0
func NewIntegerDistinctReducer() *IntegerDistinctReducer
NewIntegerDistinctReducer creates a new IntegerDistinctReducer.
func (*IntegerDistinctReducer) AggregateInteger ¶ added in v1.0.0
func (r *IntegerDistinctReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer.
func (*IntegerDistinctReducer) Emit ¶ added in v1.0.0
func (r *IntegerDistinctReducer) Emit() []IntegerPoint
Emit emits the distinct points that have been aggregated into the reducer.
type IntegerElapsedReducer ¶ added in v1.0.0
type IntegerElapsedReducer struct {
// contains filtered or unexported fields
}
IntegerElapsedReducer calculates the elapsed of the aggregated points.
func NewIntegerElapsedReducer ¶ added in v1.0.0
func NewIntegerElapsedReducer(interval Interval) *IntegerElapsedReducer
NewIntegerElapsedReducer creates a new IntegerElapsedReducer.
func (*IntegerElapsedReducer) AggregateInteger ¶ added in v1.0.0
func (r *IntegerElapsedReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer and updates the current window.
func (*IntegerElapsedReducer) Emit ¶ added in v1.0.0
func (r *IntegerElapsedReducer) Emit() []IntegerPoint
Emit emits the elapsed of the reducer at the current point.
type IntegerFuncBooleanReducer ¶ added in v0.11.0
type IntegerFuncBooleanReducer struct {
// contains filtered or unexported fields
}
IntegerFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewIntegerFuncBooleanReducer ¶ added in v0.11.0
func NewIntegerFuncBooleanReducer(fn IntegerReduceBooleanFunc, prev *BooleanPoint) *IntegerFuncBooleanReducer
NewIntegerFuncBooleanReducer creates a new IntegerFuncBooleanReducer.
func (*IntegerFuncBooleanReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerFuncBooleanReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.
func (*IntegerFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *IntegerFuncBooleanReducer) Emit() []BooleanPoint
Emit emits the point that was generated when reducing the points fed in with AggregateInteger.
type IntegerFuncFloatReducer ¶ added in v0.11.0
type IntegerFuncFloatReducer struct {
// contains filtered or unexported fields
}
IntegerFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewIntegerFuncFloatReducer ¶ added in v0.11.0
func NewIntegerFuncFloatReducer(fn IntegerReduceFloatFunc, prev *FloatPoint) *IntegerFuncFloatReducer
NewIntegerFuncFloatReducer creates a new IntegerFuncFloatReducer.
func (*IntegerFuncFloatReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerFuncFloatReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.
func (*IntegerFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *IntegerFuncFloatReducer) Emit() []FloatPoint
Emit emits the point that was generated when reducing the points fed in with AggregateInteger.
type IntegerFuncReducer ¶ added in v0.11.0
type IntegerFuncReducer struct {
// contains filtered or unexported fields
}
IntegerFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewIntegerFuncReducer ¶ added in v0.11.0
func NewIntegerFuncReducer(fn IntegerReduceFunc, prev *IntegerPoint) *IntegerFuncReducer
NewIntegerFuncReducer creates a new IntegerFuncIntegerReducer.
func (*IntegerFuncReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerFuncReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.
func (*IntegerFuncReducer) Emit ¶ added in v0.11.0
func (r *IntegerFuncReducer) Emit() []IntegerPoint
Emit emits the point that was generated when reducing the points fed in with AggregateInteger.
type IntegerFuncStringReducer ¶ added in v0.11.0
type IntegerFuncStringReducer struct {
// contains filtered or unexported fields
}
IntegerFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewIntegerFuncStringReducer ¶ added in v0.11.0
func NewIntegerFuncStringReducer(fn IntegerReduceStringFunc, prev *StringPoint) *IntegerFuncStringReducer
NewIntegerFuncStringReducer creates a new IntegerFuncStringReducer.
func (*IntegerFuncStringReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerFuncStringReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.
func (*IntegerFuncStringReducer) Emit ¶ added in v0.11.0
func (r *IntegerFuncStringReducer) Emit() []StringPoint
Emit emits the point that was generated when reducing the points fed in with AggregateInteger.
type IntegerIterator ¶ added in v0.11.0
type IntegerIterator interface { Iterator Next() (*IntegerPoint, error) }
IntegerIterator represents a stream of integer points.
type IntegerLiteral ¶ added in v0.12.0
type IntegerLiteral struct {
Val int64
}
IntegerLiteral represents an integer literal.
func (*IntegerLiteral) String ¶ added in v0.12.0
func (l *IntegerLiteral) String() string
String returns a string representation of the literal.
type IntegerMeanReducer ¶ added in v0.11.0
type IntegerMeanReducer struct {
// contains filtered or unexported fields
}
IntegerMeanReducer calculates the mean of the aggregated points.
func NewIntegerMeanReducer ¶ added in v0.11.0
func NewIntegerMeanReducer() *IntegerMeanReducer
NewIntegerMeanReducer creates a new IntegerMeanReducer.
func (*IntegerMeanReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerMeanReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer.
func (*IntegerMeanReducer) Emit ¶ added in v0.11.0
func (r *IntegerMeanReducer) Emit() []FloatPoint
Emit emits the mean of the aggregated points as a single point.
type IntegerMovingAverageReducer ¶ added in v0.12.0
type IntegerMovingAverageReducer struct {
// contains filtered or unexported fields
}
IntegerMovingAverageReducer calculates the moving average of the aggregated points.
func NewIntegerMovingAverageReducer ¶ added in v0.12.0
func NewIntegerMovingAverageReducer(n int) *IntegerMovingAverageReducer
NewIntegerMovingAverageReducer creates a new IntegerMovingAverageReducer.
func (*IntegerMovingAverageReducer) AggregateInteger ¶ added in v0.12.0
func (r *IntegerMovingAverageReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer and updates the current window.
func (*IntegerMovingAverageReducer) Emit ¶ added in v0.12.0
func (r *IntegerMovingAverageReducer) Emit() []FloatPoint
Emit emits the moving average of the current window. Emit should be called after every call to AggregateInteger and it will produce one point if there is enough data to fill a window, otherwise it will produce zero points.
type IntegerPoint ¶ added in v0.11.0
type IntegerPoint struct { Name string Tags Tags Time int64 Nil bool Value int64 Aux []interface{} // Total number of points that were combined into this point from an aggregate. // If this is zero, the point is not the result of an aggregate function. Aggregated uint32 }
IntegerPoint represents a point with a int64 value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.
func IntegerModeReduceSlice ¶ added in v1.0.0
func IntegerModeReduceSlice(a []IntegerPoint) []IntegerPoint
IntegerModeReduceSlice returns the mode value within a window.
func IntegerSpreadReduceSlice ¶ added in v0.11.0
func IntegerSpreadReduceSlice(a []IntegerPoint) []IntegerPoint
IntegerSpreadReduceSlice returns the spread value within a window.
func (*IntegerPoint) Clone ¶ added in v0.11.0
func (v *IntegerPoint) Clone() *IntegerPoint
Clone returns a copy of v.
func (*IntegerPoint) CopyTo ¶ added in v1.2.1
func (v *IntegerPoint) CopyTo(other *IntegerPoint)
CopyTo makes a deep copy into the point.
type IntegerPointAggregator ¶ added in v0.11.0
type IntegerPointAggregator interface {
AggregateInteger(p *IntegerPoint)
}
IntegerPointAggregator aggregates points to produce a single point.
type IntegerPointDecoder ¶ added in v0.11.0
type IntegerPointDecoder struct {
// contains filtered or unexported fields
}
IntegerPointDecoder decodes IntegerPoint points from a reader.
func NewIntegerPointDecoder ¶ added in v0.11.0
func NewIntegerPointDecoder(r io.Reader) *IntegerPointDecoder
NewIntegerPointDecoder returns a new instance of IntegerPointDecoder that reads from r.
func (*IntegerPointDecoder) DecodeIntegerPoint ¶ added in v0.11.0
func (dec *IntegerPointDecoder) DecodeIntegerPoint(p *IntegerPoint) error
DecodeIntegerPoint reads from the underlying reader and unmarshals into p.
func (*IntegerPointDecoder) Stats ¶ added in v0.12.0
func (dec *IntegerPointDecoder) Stats() IteratorStats
Stats returns iterator stats embedded within the stream.
type IntegerPointEmitter ¶ added in v0.11.0
type IntegerPointEmitter interface {
Emit() []IntegerPoint
}
IntegerPointEmitter produces a single point from an aggregate.
type IntegerPointEncoder ¶ added in v0.11.0
type IntegerPointEncoder struct {
// contains filtered or unexported fields
}
IntegerPointEncoder encodes IntegerPoint points to a writer.
func NewIntegerPointEncoder ¶ added in v0.11.0
func NewIntegerPointEncoder(w io.Writer) *IntegerPointEncoder
NewIntegerPointEncoder returns a new instance of IntegerPointEncoder that writes to w.
func (*IntegerPointEncoder) EncodeIntegerPoint ¶ added in v0.11.0
func (enc *IntegerPointEncoder) EncodeIntegerPoint(p *IntegerPoint) error
EncodeIntegerPoint marshals and writes p to the underlying writer.
type IntegerReduceBooleanFunc ¶ added in v0.11.0
type IntegerReduceBooleanFunc func(prev *BooleanPoint, curr *IntegerPoint) (t int64, v bool, aux []interface{})
IntegerReduceBooleanFunc is the function called by a IntegerPoint reducer.
type IntegerReduceBooleanSliceFunc ¶ added in v0.11.0
type IntegerReduceBooleanSliceFunc func(a []IntegerPoint) []BooleanPoint
IntegerReduceBooleanSliceFunc is the function called by a IntegerPoint reducer.
type IntegerReduceFloatFunc ¶ added in v0.11.0
type IntegerReduceFloatFunc func(prev *FloatPoint, curr *IntegerPoint) (t int64, v float64, aux []interface{})
IntegerReduceFloatFunc is the function called by a IntegerPoint reducer.
type IntegerReduceFloatSliceFunc ¶ added in v0.11.0
type IntegerReduceFloatSliceFunc func(a []IntegerPoint) []FloatPoint
IntegerReduceFloatSliceFunc is the function called by a IntegerPoint reducer.
type IntegerReduceFunc ¶ added in v0.11.0
type IntegerReduceFunc func(prev *IntegerPoint, curr *IntegerPoint) (t int64, v int64, aux []interface{})
IntegerReduceFunc is the function called by a IntegerPoint reducer.
type IntegerReduceSliceFunc ¶ added in v0.11.0
type IntegerReduceSliceFunc func(a []IntegerPoint) []IntegerPoint
IntegerReduceSliceFunc is the function called by a IntegerPoint reducer.
func NewIntegerBottomReduceSliceFunc ¶ added in v0.11.0
func NewIntegerBottomReduceSliceFunc(n int, tags []int, interval Interval) IntegerReduceSliceFunc
NewIntegerBottomReduceSliceFunc returns the bottom values within a window.
func NewIntegerPercentileReduceSliceFunc ¶ added in v0.11.0
func NewIntegerPercentileReduceSliceFunc(percentile float64) IntegerReduceSliceFunc
NewIntegerPercentileReduceSliceFunc returns the percentile value within a window.
func NewIntegerTopReduceSliceFunc ¶ added in v0.11.0
func NewIntegerTopReduceSliceFunc(n int, tags []int, interval Interval) IntegerReduceSliceFunc
NewIntegerTopReduceSliceFunc returns the top values within a window.
type IntegerReduceStringFunc ¶ added in v0.11.0
type IntegerReduceStringFunc func(prev *StringPoint, curr *IntegerPoint) (t int64, v string, aux []interface{})
IntegerReduceStringFunc is the function called by a IntegerPoint reducer.
type IntegerReduceStringSliceFunc ¶ added in v0.11.0
type IntegerReduceStringSliceFunc func(a []IntegerPoint) []StringPoint
IntegerReduceStringSliceFunc is the function called by a IntegerPoint reducer.
type IntegerSampleReducer ¶ added in v1.1.1
type IntegerSampleReducer struct {
// contains filtered or unexported fields
}
IntegerSampleReducer implements a reservoir sampling to calculate a random subset of points
func NewIntegerSampleReducer ¶ added in v1.1.1
func NewIntegerSampleReducer(size int) *IntegerSampleReducer
NewIntegerSampleReducer creates a new IntegerSampleReducer
func (*IntegerSampleReducer) AggregateInteger ¶ added in v1.1.1
func (r *IntegerSampleReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger aggregates a point into the reducer.
func (*IntegerSampleReducer) Emit ¶ added in v1.1.1
func (r *IntegerSampleReducer) Emit() []IntegerPoint
Emit emits the reservoir sample as many points.
type IntegerSliceFuncBooleanReducer ¶ added in v0.11.0
type IntegerSliceFuncBooleanReducer struct {
// contains filtered or unexported fields
}
IntegerSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewIntegerSliceFuncBooleanReducer ¶ added in v0.11.0
func NewIntegerSliceFuncBooleanReducer(fn IntegerReduceBooleanSliceFunc) *IntegerSliceFuncBooleanReducer
NewIntegerSliceFuncBooleanReducer creates a new IntegerSliceFuncBooleanReducer.
func (*IntegerSliceFuncBooleanReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerSliceFuncBooleanReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*IntegerSliceFuncBooleanReducer) AggregateIntegerBulk ¶ added in v0.11.0
func (r *IntegerSliceFuncBooleanReducer) AggregateIntegerBulk(points []IntegerPoint)
AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.
func (*IntegerSliceFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *IntegerSliceFuncBooleanReducer) Emit() []BooleanPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type IntegerSliceFuncFloatReducer ¶ added in v0.11.0
type IntegerSliceFuncFloatReducer struct {
// contains filtered or unexported fields
}
IntegerSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewIntegerSliceFuncFloatReducer ¶ added in v0.11.0
func NewIntegerSliceFuncFloatReducer(fn IntegerReduceFloatSliceFunc) *IntegerSliceFuncFloatReducer
NewIntegerSliceFuncFloatReducer creates a new IntegerSliceFuncFloatReducer.
func (*IntegerSliceFuncFloatReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerSliceFuncFloatReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*IntegerSliceFuncFloatReducer) AggregateIntegerBulk ¶ added in v0.11.0
func (r *IntegerSliceFuncFloatReducer) AggregateIntegerBulk(points []IntegerPoint)
AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.
func (*IntegerSliceFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *IntegerSliceFuncFloatReducer) Emit() []FloatPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type IntegerSliceFuncReducer ¶ added in v0.11.0
type IntegerSliceFuncReducer struct {
// contains filtered or unexported fields
}
IntegerSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewIntegerSliceFuncReducer ¶ added in v0.11.0
func NewIntegerSliceFuncReducer(fn IntegerReduceSliceFunc) *IntegerSliceFuncReducer
NewIntegerSliceFuncReducer creates a new IntegerSliceFuncReducer.
func (*IntegerSliceFuncReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerSliceFuncReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*IntegerSliceFuncReducer) AggregateIntegerBulk ¶ added in v0.11.0
func (r *IntegerSliceFuncReducer) AggregateIntegerBulk(points []IntegerPoint)
AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.
func (*IntegerSliceFuncReducer) Emit ¶ added in v0.11.0
func (r *IntegerSliceFuncReducer) Emit() []IntegerPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type IntegerSliceFuncStringReducer ¶ added in v0.11.0
type IntegerSliceFuncStringReducer struct {
// contains filtered or unexported fields
}
IntegerSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewIntegerSliceFuncStringReducer ¶ added in v0.11.0
func NewIntegerSliceFuncStringReducer(fn IntegerReduceStringSliceFunc) *IntegerSliceFuncStringReducer
NewIntegerSliceFuncStringReducer creates a new IntegerSliceFuncStringReducer.
func (*IntegerSliceFuncStringReducer) AggregateInteger ¶ added in v0.11.0
func (r *IntegerSliceFuncStringReducer) AggregateInteger(p *IntegerPoint)
AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*IntegerSliceFuncStringReducer) AggregateIntegerBulk ¶ added in v0.11.0
func (r *IntegerSliceFuncStringReducer) AggregateIntegerBulk(points []IntegerPoint)
AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.
func (*IntegerSliceFuncStringReducer) Emit ¶ added in v0.11.0
func (r *IntegerSliceFuncStringReducer) Emit() []StringPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type Iterator ¶
type Iterator interface { Stats() IteratorStats Close() error }
Iterator represents a generic interface for all Iterators. Most iterator operations are done on the typed sub-interfaces.
func NewCallIterator ¶ added in v0.11.0
func NewCallIterator(input Iterator, opt IteratorOptions) (Iterator, error)
NewCallIterator returns a new iterator for a Call.
func NewCloseInterruptIterator ¶ added in v1.0.0
NewCloseInterruptIterator returns an iterator that will invoke the Close() method on an iterator when the passed-in channel has been closed.
func NewDedupeIterator ¶ added in v0.11.0
NewDedupeIterator returns an iterator that only outputs unique points. This iterator maintains a serialized copy of each row so it is inefficient to use on large datasets. It is intended for small datasets such as meta queries.
func NewDistinctIterator ¶ added in v0.11.0
func NewDistinctIterator(input Iterator, opt IteratorOptions) (Iterator, error)
NewDistinctIterator returns an iterator for operating on a distinct() call.
func NewFillIterator ¶ added in v0.11.0
func NewFillIterator(input Iterator, expr Expr, opt IteratorOptions) Iterator
NewFillIterator returns an iterator that fills in missing points in an aggregate.
func NewFilterIterator ¶ added in v1.2.1
func NewFilterIterator(input Iterator, cond Expr, opt IteratorOptions) Iterator
NewFilterIterator returns an iterator that filters the points based on the condition. This iterator is not nearly as efficient as filtering points within the query engine and is only used when filtering subqueries.
func NewInterruptIterator ¶ added in v0.12.0
NewInterruptIterator returns an iterator that will stop producing output when the passed-in channel is closed.
func NewIntervalIterator ¶ added in v0.11.0
func NewIntervalIterator(input Iterator, opt IteratorOptions) Iterator
NewIntervalIterator returns an iterator that sets the time on each point to the interval.
func NewIteratorMapper ¶ added in v1.2.1
func NewIteratorMapper(itrs []Iterator, fields []int, opt IteratorOptions) Iterator
func NewLimitIterator ¶ added in v0.11.0
func NewLimitIterator(input Iterator, opt IteratorOptions) Iterator
NewLimitIterator returns an iterator that limits the number of points per grouping.
func NewMedianIterator ¶ added in v1.0.0
func NewMedianIterator(input Iterator, opt IteratorOptions) (Iterator, error)
NewMedianIterator returns an iterator for operating on a median() call.
func NewMergeIterator ¶ added in v0.11.0
func NewMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator
NewMergeIterator returns an iterator to merge itrs into one. Inputs must either be merge iterators or only contain a single name/tag in sorted order. The iterator will output all points by window, name/tag, then time. This iterator is useful when you need all of the points for an interval.
func NewModeIterator ¶ added in v1.0.0
func NewModeIterator(input Iterator, opt IteratorOptions) (Iterator, error)
newModeIterator returns an iterator for operating on a mode() call.
func NewParallelMergeIterator ¶ added in v1.0.0
func NewParallelMergeIterator(inputs []Iterator, opt IteratorOptions, parallelism int) Iterator
NewParallelMergeIterator returns an iterator that breaks input iterators into groups and processes them in parallel.
func NewReaderIterator ¶ added in v0.11.0
func NewReaderIterator(r io.Reader, typ DataType, stats IteratorStats) Iterator
NewReaderIterator returns an iterator that streams from a reader.
func NewSampleIterator ¶ added in v1.1.1
func NewSampleIterator(input Iterator, opt IteratorOptions, size int) (Iterator, error)
NewSampleIterator returns an iterator for operating on a sample() call (exported for use in test).
func NewSortedMergeIterator ¶ added in v0.11.0
func NewSortedMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator
NewSortedMergeIterator returns an iterator to merge itrs into one. Inputs must either be sorted merge iterators or only contain a single name/tag in sorted order. The iterator will output all points by name/tag, then time. This iterator is useful when you need all points for a name/tag to be in order.
func Select ¶ added in v0.11.0
func Select(stmt *SelectStatement, ic IteratorCreator, sopt *SelectOptions) ([]Iterator, error)
Select executes stmt against ic and returns a list of iterators to stream from.
Statements should have all rewriting performed before calling select(). This includes wildcard and source expansion.
type IteratorCreator ¶ added in v0.11.0
type IteratorCreator interface { // Creates a simple iterator for use in an InfluxQL query. CreateIterator(source *Measurement, opt IteratorOptions) (Iterator, error) }
IteratorCreator is an interface to create Iterators.
type IteratorEncoder ¶ added in v0.11.0
type IteratorEncoder struct { // Frequency with which stats are emitted. StatsInterval time.Duration // contains filtered or unexported fields }
IteratorEncoder is an encoder for encoding an iterator's points to w.
func NewIteratorEncoder ¶ added in v0.11.0
func NewIteratorEncoder(w io.Writer) *IteratorEncoder
NewIteratorEncoder encodes an iterator's points to w.
func (*IteratorEncoder) EncodeIterator ¶ added in v0.11.0
func (enc *IteratorEncoder) EncodeIterator(itr Iterator) error
EncodeIterator encodes and writes all of itr's points to the underlying writer.
type IteratorOptions ¶ added in v0.11.0
type IteratorOptions struct { // Expression to iterate for. // This can be VarRef or a Call. Expr Expr // Auxilary tags or values to also retrieve for the point. Aux []VarRef // Data sources from which to receive data. This is only used for encoding // measurements over RPC and is no longer used in the open source version. Sources []Source // Group by interval and tags. Interval Interval Dimensions []string // The final dimensions of the query (stays the same even in subqueries). GroupBy map[string]struct{} // Dimensions to group points by in intermediate iterators. // Fill options. Fill FillOption FillValue interface{} // Condition to filter by. Condition Expr // Time range for the iterator. StartTime int64 EndTime int64 // Sorted in time ascending order if true. Ascending bool // Limits the number of points per series. Limit, Offset int // Limits the number of series. SLimit, SOffset int // Removes duplicate rows from raw queries. Dedupe bool // Determines if this is a query for raw data or an aggregate/selector. Ordered bool // Limits on the creation of iterators. MaxSeriesN int // If this channel is set and is closed, the iterator should try to exit // and close as soon as possible. InterruptCh <-chan struct{} }
IteratorOptions is an object passed to CreateIterator to specify creation options.
func (IteratorOptions) DerivativeInterval ¶ added in v0.11.0
func (opt IteratorOptions) DerivativeInterval() Interval
DerivativeInterval returns the time interval for the derivative function.
func (IteratorOptions) ElapsedInterval ¶ added in v1.0.0
func (opt IteratorOptions) ElapsedInterval() Interval
ElapsedInterval returns the time interval for the elapsed function.
func (IteratorOptions) GetDimensions ¶ added in v1.2.1
func (opt IteratorOptions) GetDimensions() []string
GetDimensions retrieves the dimensions for this query.
func (*IteratorOptions) MarshalBinary ¶ added in v0.11.0
func (opt *IteratorOptions) MarshalBinary() ([]byte, error)
MarshalBinary encodes opt into a binary format.
func (IteratorOptions) MergeSorted ¶ added in v0.11.0
func (opt IteratorOptions) MergeSorted() bool
MergeSorted returns true if the options require a sorted merge.
func (IteratorOptions) SeekTime ¶ added in v0.11.0
func (opt IteratorOptions) SeekTime() int64
SeekTime returns the time the iterator should start from. For ascending iterators this is the start time, for descending iterators it's the end time.
func (*IteratorOptions) UnmarshalBinary ¶ added in v0.11.0
func (opt *IteratorOptions) UnmarshalBinary(buf []byte) error
UnmarshalBinary decodes from a binary format in to opt.
func (IteratorOptions) Window ¶ added in v0.11.0
func (opt IteratorOptions) Window(t int64) (start, end int64)
Window returns the time window [start,end) that t falls within.
type IteratorStats ¶ added in v0.12.0
IteratorStats represents statistics about an iterator. Some statistics are available immediately upon iterator creation while some are derived as the iterator processes data.
func (*IteratorStats) Add ¶ added in v0.12.0
func (s *IteratorStats) Add(other IteratorStats)
Add aggregates fields from s and other together. Overwrites s.
type Iterators ¶ added in v0.11.0
type Iterators []Iterator
Iterators represents a list of iterators.
func (Iterators) Merge ¶ added in v1.0.0
func (a Iterators) Merge(opt IteratorOptions) (Iterator, error)
Merge combines all iterators into a single iterator. A sorted merge iterator or a merge iterator can be used based on opt.
func (Iterators) Stats ¶ added in v0.12.0
func (a Iterators) Stats() IteratorStats
Stats returns the aggregation of all iterator stats.
type KillQueryStatement ¶ added in v0.12.0
type KillQueryStatement struct { // The query to kill. QueryID uint64 // The host to delegate the kill to. Host string }
KillQueryStatement represents a command for killing a query.
func (*KillQueryStatement) RequiredPrivileges ¶ added in v0.12.0
func (s *KillQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a KillQueryStatement.
func (*KillQueryStatement) String ¶ added in v0.12.0
func (s *KillQueryStatement) String() string
String returns a string representation of the kill query statement.
type ListLiteral ¶ added in v1.0.0
type ListLiteral struct {
Vals []string
}
ListLiteral represents a list of tag key literals.
func (*ListLiteral) String ¶ added in v1.0.0
func (s *ListLiteral) String() string
String returns a string representation of the literal.
type Literal ¶ added in v0.11.0
type Literal interface { Expr // contains filtered or unexported methods }
Literal represents a static literal.
type Measurement ¶
type Measurement struct { Database string RetentionPolicy string Name string Regex *RegexLiteral IsTarget bool }
Measurement represents a single measurement used as a datasource.
func (*Measurement) String ¶
func (m *Measurement) String() string
String returns a string representation of the measurement.
type Measurements ¶
type Measurements []*Measurement
Measurements represents a list of measurements.
func (Measurements) String ¶
func (a Measurements) String() string
String returns a string representation of the measurements.
type Message ¶ added in v1.0.0
Message represents a user-facing message to be included with the result.
func ReadOnlyWarning ¶ added in v1.0.0
ReadOnlyWarning generates a warning message that tells the user the command they are using is being used for writing in a read only context.
This is a temporary method while to be used while transitioning to read only operations for issue #6290.
type Node ¶
type Node interface { String() string // contains filtered or unexported methods }
Node represents a node in the InfluxDB abstract syntax tree.
type NumberLiteral ¶
type NumberLiteral struct {
Val float64
}
NumberLiteral represents a numeric literal.
func (*NumberLiteral) String ¶
func (l *NumberLiteral) String() string
String returns a string representation of the literal.
type ParenExpr ¶
type ParenExpr struct {
Expr Expr
}
ParenExpr represents a parenthesized expression.
type ParseError ¶
ParseError represents an error that occurred during parsing.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error returns the string representation of the error.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents an InfluxQL parser.
func (*Parser) ParseQuery ¶
ParseQuery parses an InfluxQL string and returns a Query AST object.
func (*Parser) ParseStatement ¶
ParseStatement parses an InfluxQL string and returns a Statement AST object.
type Point ¶ added in v0.11.0
type Point interface {
// contains filtered or unexported methods
}
Point represents a value in a series that occurred at a given time.
type PointDecoder ¶ added in v0.11.0
type PointDecoder struct {
// contains filtered or unexported fields
}
PointDecoder decodes generic points from a reader.
func NewPointDecoder ¶ added in v0.11.0
func NewPointDecoder(r io.Reader) *PointDecoder
NewPointDecoder returns a new instance of PointDecoder that reads from r.
func (*PointDecoder) DecodePoint ¶ added in v0.11.0
func (dec *PointDecoder) DecodePoint(p *Point) error
DecodePoint reads from the underlying reader and unmarshals into p.
func (*PointDecoder) Stats ¶ added in v0.12.0
func (dec *PointDecoder) Stats() IteratorStats
Stats returns iterator stats embedded within the stream.
type Pos ¶
Pos specifies the line and character position of a token. The Char and Line are both zero-based indexes.
type Privilege ¶
type Privilege int
Privilege is a type of action a user can be granted the right to use.
const ( // NoPrivileges means no privileges required / granted / revoked. NoPrivileges Privilege = iota // ReadPrivilege means read privilege required / granted / revoked. ReadPrivilege // WritePrivilege means write privilege required / granted / revoked. WritePrivilege // AllPrivileges means all privileges required / granted / revoked. AllPrivileges )
func NewPrivilege ¶
NewPrivilege returns an initialized *Privilege.
type Query ¶
type Query struct {
Statements Statements
}
Query represents a collection of ordered statements.
func ParseQuery ¶
ParseQuery parses a query string and returns its AST representation.
type QueryExecutor ¶ added in v0.11.0
type QueryExecutor struct { // Used for executing a statement in the query. StatementExecutor StatementExecutor // Used for tracking running queries. TaskManager *TaskManager // Logger to use for all logging. // Defaults to discarding all log output. Logger zap.Logger // contains filtered or unexported fields }
QueryExecutor executes every statement in an Query.
func NewQueryExecutor ¶ added in v1.0.0
func NewQueryExecutor() *QueryExecutor
NewQueryExecutor returns a new instance of QueryExecutor.
func (*QueryExecutor) Close ¶ added in v1.0.0
func (e *QueryExecutor) Close() error
Close kills all running queries and prevents new queries from being attached.
func (*QueryExecutor) ExecuteQuery ¶ added in v0.11.0
func (e *QueryExecutor) ExecuteQuery(query *Query, opt ExecutionOptions, closing chan struct{}) <-chan *Result
ExecuteQuery executes each statement within a query.
func (*QueryExecutor) Statistics ¶ added in v1.0.0
func (e *QueryExecutor) Statistics(tags map[string]string) []models.Statistic
Statistics returns statistics for periodic monitoring.
func (*QueryExecutor) WithLogger ¶ added in v1.2.1
func (e *QueryExecutor) WithLogger(log zap.Logger)
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.
type QueryInfo ¶ added in v1.0.0
type QueryInfo struct { ID uint64 `json:"id"` Query string `json:"query"` Database string `json:"database"` Duration time.Duration `json:"duration"` }
QueryInfo represents the information for a query.
type QueryMonitorFunc ¶ added in v0.12.0
type QueryMonitorFunc func(<-chan struct{}) error
QueryMonitorFunc is a function that will be called to check if a query is currently healthy. If the query needs to be interrupted for some reason, the error should be returned by this function.
func PointLimitMonitor ¶ added in v0.12.0
func PointLimitMonitor(itrs Iterators, interval time.Duration, limit int) QueryMonitorFunc
PointLimitMonitor is a query monitor that exits when the number of points emitted exceeds a threshold.
type QueryStatistics ¶ added in v1.0.0
type QueryStatistics struct { ActiveQueries int64 ExecutedQueries int64 FinishedQueries int64 QueryExecutionDuration int64 }
QueryStatistics keeps statistics related to the QueryExecutor.
type QueryTask ¶ added in v1.0.0
type QueryTask struct {
// contains filtered or unexported fields
}
QueryTask is the internal data structure for managing queries. For the public use data structure that gets returned, see QueryTask.
func (*QueryTask) Error ¶ added in v1.0.0
Error returns any asynchronous error that may have occured while executing the query.
func (*QueryTask) Monitor ¶ added in v1.0.0
func (q *QueryTask) Monitor(fn QueryMonitorFunc)
Monitor starts a new goroutine that will monitor a query. The function will be passed in a channel to signal when the query has been finished normally. If the function returns with an error and the query is still running, the query will be terminated.
type RegexLiteral ¶
RegexLiteral represents a regular expression.
func CloneRegexLiteral ¶
func CloneRegexLiteral(r *RegexLiteral) *RegexLiteral
CloneRegexLiteral returns a clone of the RegexLiteral.
func (*RegexLiteral) String ¶
func (r *RegexLiteral) String() string
String returns a string representation of the literal.
type Result ¶
type Result struct { // StatementID is just the statement's position in the query. It's used // to combine statement results if they're being buffered in memory. StatementID int Series models.Rows Messages []*Message Partial bool Err error }
Result represents a resultset returned from a single statement. Rows represents a list of rows that can be sorted consistently by name/tag.
func (*Result) MarshalJSON ¶
MarshalJSON encodes the result into JSON.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON decodes the data into the Result struct
type RevokeAdminStatement ¶ added in v0.9.2
type RevokeAdminStatement struct { // Who to revoke admin privilege from. User string }
RevokeAdminStatement represents a command to revoke admin privilege from a user.
func (*RevokeAdminStatement) RequiredPrivileges ¶ added in v0.9.2
func (s *RevokeAdminStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a RevokeAdminStatement.
func (*RevokeAdminStatement) String ¶ added in v0.9.2
func (s *RevokeAdminStatement) String() string
String returns a string representation of the revoke admin statement.
type RevokeStatement ¶
type RevokeStatement struct { // The privilege to be revoked. Privilege Privilege // Database to revoke the privilege from. On string // Who to revoke privilege from. User string }
RevokeStatement represents a command to revoke a privilege from a user.
func (*RevokeStatement) RequiredPrivileges ¶
func (s *RevokeStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a RevokeStatement.
func (*RevokeStatement) String ¶
func (s *RevokeStatement) String() string
String returns a string representation of the revoke statement.
type Rewriter ¶
Rewriter can be called by Rewrite to replace nodes in the AST hierarchy. The Rewrite() function is called once per node.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a lexical scanner for InfluxQL.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type SelectOptions ¶ added in v0.11.0
type SelectOptions struct { // The lower bound for a select call. MinTime time.Time // The upper bound for a select call. MaxTime time.Time // Node to exclusively read from. // If zero, all nodes are used. NodeID uint64 // An optional channel that, if closed, signals that the select should be // interrupted. InterruptCh <-chan struct{} // Maximum number of concurrent series. MaxSeriesN int }
SelectOptions are options that customize the select call.
type SelectStatement ¶
type SelectStatement struct { // Expressions returned from the selection. Fields Fields // Target (destination) for the result of a SELECT INTO query. Target *Target // Expressions used for grouping the selection. Dimensions Dimensions // Data sources (measurements) that fields are extracted from. Sources Sources // An expression evaluated on data point. Condition Expr // Fields to sort results by. SortFields SortFields // Maximum number of rows to be returned. Unlimited if zero. Limit int // Returns rows starting at an offset from the first row. Offset int // Maxiumum number of series to be returned. Unlimited if zero. SLimit int // Returns series starting at an offset from the first one. SOffset int // Whether it's a query for raw data values (i.e. not an aggregate). IsRawQuery bool // What fill option the select statement uses, if any. Fill FillOption // The value to fill empty aggregate buckets with, if any. FillValue interface{} // Renames the implicit time field name. TimeAlias string // Removes the "time" column from the output. OmitTime bool // Removes duplicate rows from raw queries. Dedupe bool // contains filtered or unexported fields }
SelectStatement represents a command for extracting data from the database.
func (*SelectStatement) Clone ¶
func (s *SelectStatement) Clone() *SelectStatement
Clone returns a deep copy of the statement.
func (*SelectStatement) ColumnNames ¶ added in v0.9.5
func (s *SelectStatement) ColumnNames() []string
ColumnNames will walk all fields and functions and return the appropriate field names for the select statement while maintaining order of the field names.
func (*SelectStatement) FieldExprByName ¶ added in v1.2.1
func (s *SelectStatement) FieldExprByName(name string) (int, Expr)
FieldExprByName returns the expression that matches the field name and the index where this was found. If the name matches one of the arguments to "top" or "bottom", the variable reference inside of the function is returned and the index is of the function call rather than the variable reference. If no expression is found, -1 is returned for the index and the expression will be nil.
func (*SelectStatement) FunctionCalls ¶
func (s *SelectStatement) FunctionCalls() []*Call
FunctionCalls returns the Call objects from the query.
func (*SelectStatement) FunctionCallsByPosition ¶ added in v0.9.5
func (s *SelectStatement) FunctionCallsByPosition() [][]*Call
FunctionCallsByPosition returns the Call objects from the query in the order they appear in the select statement.
func (*SelectStatement) GroupByInterval ¶
func (s *SelectStatement) GroupByInterval() (time.Duration, error)
GroupByInterval extracts the time interval, if specified.
func (*SelectStatement) GroupByOffset ¶ added in v1.0.0
func (s *SelectStatement) GroupByOffset() (time.Duration, error)
GroupByOffset extracts the time interval offset, if specified.
func (*SelectStatement) HasDerivative ¶
func (s *SelectStatement) HasDerivative() bool
HasDerivative returns true if any function call in the statement is a derivative aggregate.
func (*SelectStatement) HasDimensionWildcard ¶ added in v0.9.3
func (s *SelectStatement) HasDimensionWildcard() bool
HasDimensionWildcard returns whether or not the select statement has at least 1 wildcard in the dimensions aka `GROUP BY`.
func (*SelectStatement) HasDistinct ¶
func (s *SelectStatement) HasDistinct() bool
HasDistinct checks if a select statement contains a call to DISTINCT.
func (*SelectStatement) HasFieldWildcard ¶ added in v0.9.3
func (s *SelectStatement) HasFieldWildcard() (hasWildcard bool)
HasFieldWildcard returns whether or not the select statement has at least 1 wildcard in the fields.
func (*SelectStatement) HasSelector ¶ added in v1.2.1
func (s *SelectStatement) HasSelector() bool
HasSelector returns true if there is exactly one selector.
func (*SelectStatement) HasTimeFieldSpecified ¶ added in v0.9.5
func (s *SelectStatement) HasTimeFieldSpecified() bool
HasTimeFieldSpecified will walk all fields and determine if the user explicitly asked for time. This is needed to determine re-write behaviors for functions like TOP and BOTTOM.
func (*SelectStatement) HasWildcard ¶
func (s *SelectStatement) HasWildcard() bool
HasWildcard returns whether or not the select statement has at least 1 wildcard.
func (*SelectStatement) IsSimpleDerivative ¶
func (s *SelectStatement) IsSimpleDerivative() bool
IsSimpleDerivative return true if any function call is a derivative function with a variable ref as the first arg.
func (*SelectStatement) NamesInDimension ¶ added in v0.9.3
func (s *SelectStatement) NamesInDimension() []string
NamesInDimension returns the field and tag names (idents) in the group by clause.
func (*SelectStatement) NamesInSelect ¶
func (s *SelectStatement) NamesInSelect() []string
NamesInSelect returns the field and tag names (idents) in the select clause.
func (*SelectStatement) NamesInWhere ¶
func (s *SelectStatement) NamesInWhere() []string
NamesInWhere returns the field and tag names (idents) referenced in the where clause.
func (*SelectStatement) Reduce ¶ added in v1.2.1
func (s *SelectStatement) Reduce(valuer Valuer) *SelectStatement
Reduce calls the Reduce function on the different components of the SelectStatement to reduce the statement.
func (*SelectStatement) RequiredPrivileges ¶
func (s *SelectStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute the SelectStatement. NOTE: Statement should be normalized first (database name(s) in Sources and Target should be populated). If the statement has not been normalized, an empty string will be returned for the database name and it is up to the caller to interpret that as the default database.
func (*SelectStatement) RewriteDistinct ¶
func (s *SelectStatement) RewriteDistinct()
RewriteDistinct rewrites the expression to be a call for map/reduce to work correctly. This method assumes all validation has passed.
func (*SelectStatement) RewriteFields ¶ added in v1.0.0
func (s *SelectStatement) RewriteFields(m FieldMapper) (*SelectStatement, error)
RewriteFields returns the re-written form of the select statement. Any wildcard query fields are replaced with the supplied fields, and any wildcard GROUP BY fields are replaced with the supplied dimensions. Any fields with no type specifier are rewritten with the appropriate type.
func (*SelectStatement) RewriteRegexConditions ¶ added in v1.1.1
func (s *SelectStatement) RewriteRegexConditions()
RewriteRegexConditions rewrites regex conditions to make better use of the database index.
Conditions that can currently be simplified are:
- host =~ /^foo$/ becomes host = 'foo'
- host !~ /^foo$/ becomes host != 'foo'
Note: if the regex contains groups, character classes, repetition or similar, it's likely it won't be rewritten. In order to support rewriting regexes with these characters would be a lot more work.
func (*SelectStatement) RewriteTimeCondition ¶ added in v1.2.1
func (s *SelectStatement) RewriteTimeCondition(now time.Time) error
RewriteTimeCondition adds time constraints to aggregate queries.
func (*SelectStatement) RewriteTimeFields ¶ added in v0.11.0
func (s *SelectStatement) RewriteTimeFields()
RewriteTimeFields removes any "time" field references.
func (*SelectStatement) SetTimeRange ¶
func (s *SelectStatement) SetTimeRange(start, end time.Time) error
SetTimeRange sets the start and end time of the select statement to [start, end). i.e. start inclusive, end exclusive. This is used commonly for continuous queries so the start and end are in buckets.
func (*SelectStatement) String ¶
func (s *SelectStatement) String() string
String returns a string representation of the select statement.
func (*SelectStatement) TimeAscending ¶ added in v0.9.5
func (s *SelectStatement) TimeAscending() bool
TimeAscending returns true if the time field is sorted in chronological order.
func (*SelectStatement) TimeFieldName ¶ added in v1.0.0
func (s *SelectStatement) TimeFieldName() string
TimeFieldName returns the name of the time field.
type SetPasswordUserStatement ¶
type SetPasswordUserStatement struct { // Plain-text password. Password string // Who to grant the privilege to. Name string }
SetPasswordUserStatement represents a command for changing user password.
func (*SetPasswordUserStatement) RequiredPrivileges ¶
func (s *SetPasswordUserStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a SetPasswordUserStatement.
func (*SetPasswordUserStatement) String ¶
func (s *SetPasswordUserStatement) String() string
String returns a string representation of the set password statement.
type ShowContinuousQueriesStatement ¶
type ShowContinuousQueriesStatement struct{}
ShowContinuousQueriesStatement represents a command for listing continuous queries.
func (*ShowContinuousQueriesStatement) RequiredPrivileges ¶
func (s *ShowContinuousQueriesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowContinuousQueriesStatement.
func (*ShowContinuousQueriesStatement) String ¶
func (s *ShowContinuousQueriesStatement) String() string
String returns a string representation of the show continuous queries statement.
type ShowDatabasesStatement ¶
type ShowDatabasesStatement struct{}
ShowDatabasesStatement represents a command for listing all databases in the cluster.
func (*ShowDatabasesStatement) RequiredPrivileges ¶
func (s *ShowDatabasesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowDatabasesStatement.
func (*ShowDatabasesStatement) String ¶
func (s *ShowDatabasesStatement) String() string
String returns a string representation of the show databases command.
type ShowDiagnosticsStatement ¶
type ShowDiagnosticsStatement struct { // Module Module string }
ShowDiagnosticsStatement represents a command for show node diagnostics.
func (*ShowDiagnosticsStatement) RequiredPrivileges ¶
func (s *ShowDiagnosticsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowDiagnosticsStatement
func (*ShowDiagnosticsStatement) String ¶
func (s *ShowDiagnosticsStatement) String() string
String returns a string representation of the ShowDiagnosticsStatement.
type ShowFieldKeysStatement ¶
type ShowFieldKeysStatement struct { // Database to query. If blank, use the default database. // The database can also be specified per source in the Sources. Database string // Data sources that fields are extracted from. Sources Sources // Fields to sort results by SortFields SortFields // Maximum number of rows to be returned. // Unlimited if zero. Limit int // Returns rows starting at an offset from the first row. Offset int }
ShowFieldKeysStatement represents a command for listing field keys.
func (*ShowFieldKeysStatement) RequiredPrivileges ¶
func (s *ShowFieldKeysStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowFieldKeysStatement.
func (*ShowFieldKeysStatement) String ¶
func (s *ShowFieldKeysStatement) String() string
String returns a string representation of the statement.
type ShowGrantsForUserStatement ¶ added in v0.9.1
type ShowGrantsForUserStatement struct { // Name of the user to display privileges. Name string }
ShowGrantsForUserStatement represents a command for listing user privileges.
func (*ShowGrantsForUserStatement) RequiredPrivileges ¶ added in v0.9.1
func (s *ShowGrantsForUserStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowGrantsForUserStatement
func (*ShowGrantsForUserStatement) String ¶ added in v0.9.1
func (s *ShowGrantsForUserStatement) String() string
String returns a string representation of the show grants for user.
type ShowMeasurementsStatement ¶
type ShowMeasurementsStatement struct { // Database to query. If blank, use the default database. Database string // Measurement name or regex. Source Source // An expression evaluated on data point. Condition Expr // Fields to sort results by SortFields SortFields // Maximum number of rows to be returned. // Unlimited if zero. Limit int // Returns rows starting at an offset from the first row. Offset int }
ShowMeasurementsStatement represents a command for listing measurements.
func (*ShowMeasurementsStatement) RequiredPrivileges ¶
func (s *ShowMeasurementsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowMeasurementsStatement.
func (*ShowMeasurementsStatement) String ¶
func (s *ShowMeasurementsStatement) String() string
String returns a string representation of the statement.
type ShowQueriesStatement ¶ added in v0.12.0
type ShowQueriesStatement struct{}
ShowQueriesStatement represents a command for listing all running queries.
func (*ShowQueriesStatement) RequiredPrivileges ¶ added in v0.12.0
func (s *ShowQueriesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowQueriesStatement.
func (*ShowQueriesStatement) String ¶ added in v0.12.0
func (s *ShowQueriesStatement) String() string
String returns a string representation of the show queries statement.
type ShowRetentionPoliciesStatement ¶
type ShowRetentionPoliciesStatement struct { // Name of the database to list policies for. Database string }
ShowRetentionPoliciesStatement represents a command for listing retention policies.
func (*ShowRetentionPoliciesStatement) RequiredPrivileges ¶
func (s *ShowRetentionPoliciesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowRetentionPoliciesStatement
func (*ShowRetentionPoliciesStatement) String ¶
func (s *ShowRetentionPoliciesStatement) String() string
String returns a string representation of a ShowRetentionPoliciesStatement.
type ShowSeriesStatement ¶
type ShowSeriesStatement struct { // Database to query. If blank, use the default database. // The database can also be specified per source in the Sources. Database string // Measurement(s) the series are listed for. Sources Sources // An expression evaluated on a series name or tag. Condition Expr // Fields to sort results by SortFields SortFields // Maximum number of rows to be returned. // Unlimited if zero. Limit int // Returns rows starting at an offset from the first row. Offset int }
ShowSeriesStatement represents a command for listing series in the database.
func (*ShowSeriesStatement) RequiredPrivileges ¶
func (s *ShowSeriesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowSeriesStatement.
func (*ShowSeriesStatement) String ¶
func (s *ShowSeriesStatement) String() string
String returns a string representation of the list series statement.
type ShowShardGroupsStatement ¶ added in v0.10.0
type ShowShardGroupsStatement struct{}
ShowShardGroupsStatement represents a command for displaying shard groups in the cluster.
func (*ShowShardGroupsStatement) RequiredPrivileges ¶ added in v0.10.0
func (s *ShowShardGroupsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privileges required to execute the statement.
func (*ShowShardGroupsStatement) String ¶ added in v0.10.0
func (s *ShowShardGroupsStatement) String() string
String returns a string representation of the SHOW SHARD GROUPS command.
type ShowShardsStatement ¶ added in v0.9.5
type ShowShardsStatement struct{}
ShowShardsStatement represents a command for displaying shards in the cluster.
func (*ShowShardsStatement) RequiredPrivileges ¶ added in v0.9.5
func (s *ShowShardsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privileges required to execute the statement.
func (*ShowShardsStatement) String ¶ added in v0.9.5
func (s *ShowShardsStatement) String() string
String returns a string representation.
type ShowStatsStatement ¶
type ShowStatsStatement struct {
Module string
}
ShowStatsStatement displays statistics for a given module.
func (*ShowStatsStatement) RequiredPrivileges ¶
func (s *ShowStatsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowStatsStatement
func (*ShowStatsStatement) String ¶
func (s *ShowStatsStatement) String() string
String returns a string representation of a ShowStatsStatement.
type ShowSubscriptionsStatement ¶ added in v0.9.5
type ShowSubscriptionsStatement struct { }
ShowSubscriptionsStatement represents a command to show a list of subscriptions.
func (*ShowSubscriptionsStatement) RequiredPrivileges ¶ added in v0.9.5
func (s *ShowSubscriptionsStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege required to execute a ShowSubscriptionsStatement.
func (*ShowSubscriptionsStatement) String ¶ added in v0.9.5
func (s *ShowSubscriptionsStatement) String() string
String returns a string representation of the ShowSubscriptionsStatement.
type ShowTagKeysStatement ¶
type ShowTagKeysStatement struct { // Database to query. If blank, use the default database. // The database can also be specified per source in the Sources. Database string // Data sources that fields are extracted from. Sources Sources // An expression evaluated on data point. Condition Expr // Fields to sort results by. SortFields SortFields // Maximum number of tag keys per measurement. Unlimited if zero. Limit int // Returns tag keys starting at an offset from the first row. Offset int // Maxiumum number of series to be returned. Unlimited if zero. SLimit int // Returns series starting at an offset from the first one. SOffset int }
ShowTagKeysStatement represents a command for listing tag keys.
func (*ShowTagKeysStatement) RequiredPrivileges ¶
func (s *ShowTagKeysStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowTagKeysStatement.
func (*ShowTagKeysStatement) String ¶
func (s *ShowTagKeysStatement) String() string
String returns a string representation of the statement.
type ShowTagValuesStatement ¶
type ShowTagValuesStatement struct { // Database to query. If blank, use the default database. // The database can also be specified per source in the Sources. Database string // Data source that fields are extracted from. Sources Sources // Operation to use when selecting tag key(s). Op Token // Literal to compare the tag key(s) with. TagKeyExpr Literal // An expression evaluated on data point. Condition Expr // Fields to sort results by. SortFields SortFields // Maximum number of rows to be returned. // Unlimited if zero. Limit int // Returns rows starting at an offset from the first row. Offset int }
ShowTagValuesStatement represents a command for listing tag values.
func (*ShowTagValuesStatement) RequiredPrivileges ¶
func (s *ShowTagValuesStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowTagValuesStatement.
func (*ShowTagValuesStatement) String ¶
func (s *ShowTagValuesStatement) String() string
String returns a string representation of the statement.
type ShowUsersStatement ¶
type ShowUsersStatement struct{}
ShowUsersStatement represents a command for listing users.
func (*ShowUsersStatement) RequiredPrivileges ¶
func (s *ShowUsersStatement) RequiredPrivileges() (ExecutionPrivileges, error)
RequiredPrivileges returns the privilege(s) required to execute a ShowUsersStatement
func (*ShowUsersStatement) String ¶
func (s *ShowUsersStatement) String() string
String returns a string representation of the ShowUsersStatement.
type SortFields ¶
type SortFields []*SortField
SortFields represents an ordered list of ORDER BY fields.
func (SortFields) String ¶
func (a SortFields) String() string
String returns a string representation of sort fields.
type Source ¶
type Source interface { Node // contains filtered or unexported methods }
Source represents a source of data for a statement.
type Sources ¶
type Sources []Source
Sources represents a list of sources.
func (Sources) Filter ¶ added in v1.0.0
Filter returns a list of source names filtered by the database/retention policy.
func (Sources) HasRegex ¶ added in v0.12.0
HasRegex returns true if any of the sources are regex measurements.
func (Sources) HasSystemSource ¶ added in v0.11.0
HasSystemSource returns true if any of the sources are internal, system sources.
func (Sources) MarshalBinary ¶ added in v0.11.0
MarshalBinary encodes a list of sources to a binary format.
func (Sources) Measurements ¶ added in v1.2.1
func (a Sources) Measurements() []*Measurement
Measurements returns all measurements including ones embedded in subqueries.
func (*Sources) UnmarshalBinary ¶ added in v0.11.0
UnmarshalBinary decodes binary data into a list of sources.
type Statement ¶
type Statement interface { Node RequiredPrivileges() (ExecutionPrivileges, error) // contains filtered or unexported methods }
Statement represents a single command in InfluxQL.
func MustParseStatement ¶
MustParseStatement parses a statement string and returns its AST. Panic on error.
func ParseStatement ¶
ParseStatement parses a statement string and returns its AST representation.
func RewriteStatement ¶ added in v0.11.0
RewriteStatement rewrites stmt into a new statement, if applicable.
type StatementExecutor ¶ added in v1.0.0
type StatementExecutor interface { // ExecuteStatement executes a statement. Results should be sent to the // results channel in the ExecutionContext. ExecuteStatement(stmt Statement, ctx ExecutionContext) error }
StatementExecutor executes a statement within the QueryExecutor.
type StatementNormalizer ¶ added in v1.0.0
type StatementNormalizer interface { // NormalizeStatement adds a default database and policy to the // measurements in the statement. NormalizeStatement(stmt Statement, database string) error }
StatementNormalizer normalizes a statement before it is executed.
type Statements ¶
type Statements []Statement
Statements represents a list of statements.
func (Statements) String ¶
func (a Statements) String() string
String returns a string representation of the statements.
type StringBulkPointAggregator ¶ added in v0.11.0
type StringBulkPointAggregator interface {
AggregateStringBulk(points []StringPoint)
}
StringBulkPointAggregator aggregates multiple points at a time.
type StringDistinctReducer ¶ added in v1.0.0
type StringDistinctReducer struct {
// contains filtered or unexported fields
}
StringDistinctReducer returns the distinct points in a series.
func NewStringDistinctReducer ¶ added in v1.0.0
func NewStringDistinctReducer() *StringDistinctReducer
NewStringDistinctReducer creates a new StringDistinctReducer.
func (*StringDistinctReducer) AggregateString ¶ added in v1.0.0
func (r *StringDistinctReducer) AggregateString(p *StringPoint)
AggregateString aggregates a point into the reducer.
func (*StringDistinctReducer) Emit ¶ added in v1.0.0
func (r *StringDistinctReducer) Emit() []StringPoint
Emit emits the distinct points that have been aggregated into the reducer.
type StringElapsedReducer ¶ added in v1.0.0
type StringElapsedReducer struct {
// contains filtered or unexported fields
}
StringElapsedReducer calculates the elapsed of the aggregated points.
func NewStringElapsedReducer ¶ added in v1.0.0
func NewStringElapsedReducer(interval Interval) *StringElapsedReducer
NewStringElapsedReducer creates a new StringElapsedReducer.
func (*StringElapsedReducer) AggregateString ¶ added in v1.0.0
func (r *StringElapsedReducer) AggregateString(p *StringPoint)
AggregateString aggregates a point into the reducer and updates the current window.
func (*StringElapsedReducer) Emit ¶ added in v1.0.0
func (r *StringElapsedReducer) Emit() []IntegerPoint
Emit emits the elapsed of the reducer at the current point.
type StringFuncBooleanReducer ¶ added in v0.11.0
type StringFuncBooleanReducer struct {
// contains filtered or unexported fields
}
StringFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewStringFuncBooleanReducer ¶ added in v0.11.0
func NewStringFuncBooleanReducer(fn StringReduceBooleanFunc, prev *BooleanPoint) *StringFuncBooleanReducer
NewStringFuncBooleanReducer creates a new StringFuncBooleanReducer.
func (*StringFuncBooleanReducer) AggregateString ¶ added in v0.11.0
func (r *StringFuncBooleanReducer) AggregateString(p *StringPoint)
AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.
func (*StringFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *StringFuncBooleanReducer) Emit() []BooleanPoint
Emit emits the point that was generated when reducing the points fed in with AggregateString.
type StringFuncFloatReducer ¶ added in v0.11.0
type StringFuncFloatReducer struct {
// contains filtered or unexported fields
}
StringFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewStringFuncFloatReducer ¶ added in v0.11.0
func NewStringFuncFloatReducer(fn StringReduceFloatFunc, prev *FloatPoint) *StringFuncFloatReducer
NewStringFuncFloatReducer creates a new StringFuncFloatReducer.
func (*StringFuncFloatReducer) AggregateString ¶ added in v0.11.0
func (r *StringFuncFloatReducer) AggregateString(p *StringPoint)
AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.
func (*StringFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *StringFuncFloatReducer) Emit() []FloatPoint
Emit emits the point that was generated when reducing the points fed in with AggregateString.
type StringFuncIntegerReducer ¶ added in v0.11.0
type StringFuncIntegerReducer struct {
// contains filtered or unexported fields
}
StringFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewStringFuncIntegerReducer ¶ added in v0.11.0
func NewStringFuncIntegerReducer(fn StringReduceIntegerFunc, prev *IntegerPoint) *StringFuncIntegerReducer
NewStringFuncIntegerReducer creates a new StringFuncIntegerReducer.
func (*StringFuncIntegerReducer) AggregateString ¶ added in v0.11.0
func (r *StringFuncIntegerReducer) AggregateString(p *StringPoint)
AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.
func (*StringFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *StringFuncIntegerReducer) Emit() []IntegerPoint
Emit emits the point that was generated when reducing the points fed in with AggregateString.
type StringFuncReducer ¶ added in v0.11.0
type StringFuncReducer struct {
// contains filtered or unexported fields
}
StringFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.
func NewStringFuncReducer ¶ added in v0.11.0
func NewStringFuncReducer(fn StringReduceFunc, prev *StringPoint) *StringFuncReducer
NewStringFuncReducer creates a new StringFuncStringReducer.
func (*StringFuncReducer) AggregateString ¶ added in v0.11.0
func (r *StringFuncReducer) AggregateString(p *StringPoint)
AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.
func (*StringFuncReducer) Emit ¶ added in v0.11.0
func (r *StringFuncReducer) Emit() []StringPoint
Emit emits the point that was generated when reducing the points fed in with AggregateString.
type StringIterator ¶ added in v0.11.0
type StringIterator interface { Iterator Next() (*StringPoint, error) }
StringIterator represents a stream of string points.
type StringLiteral ¶
type StringLiteral struct {
Val string
}
StringLiteral represents a string literal.
func (*StringLiteral) IsTimeLiteral ¶ added in v1.0.2
func (l *StringLiteral) IsTimeLiteral() bool
IsTimeLiteral returns if this string can be interpreted as a time literal.
func (*StringLiteral) String ¶
func (l *StringLiteral) String() string
String returns a string representation of the literal.
func (*StringLiteral) ToTimeLiteral ¶ added in v1.0.2
func (l *StringLiteral) ToTimeLiteral() (*TimeLiteral, error)
ToTimeLiteral returns a time literal if this string can be converted to a time literal.
type StringPoint ¶ added in v0.11.0
type StringPoint struct { Name string Tags Tags Time int64 Nil bool Value string Aux []interface{} // Total number of points that were combined into this point from an aggregate. // If this is zero, the point is not the result of an aggregate function. Aggregated uint32 }
StringPoint represents a point with a string value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.
func StringModeReduceSlice ¶ added in v1.0.0
func StringModeReduceSlice(a []StringPoint) []StringPoint
StringModeReduceSlice returns the mode value within a window.
func (*StringPoint) Clone ¶ added in v0.11.0
func (v *StringPoint) Clone() *StringPoint
Clone returns a copy of v.
func (*StringPoint) CopyTo ¶ added in v1.2.1
func (v *StringPoint) CopyTo(other *StringPoint)
CopyTo makes a deep copy into the point.
type StringPointAggregator ¶ added in v0.11.0
type StringPointAggregator interface {
AggregateString(p *StringPoint)
}
StringPointAggregator aggregates points to produce a single point.
type StringPointDecoder ¶ added in v0.11.0
type StringPointDecoder struct {
// contains filtered or unexported fields
}
StringPointDecoder decodes StringPoint points from a reader.
func NewStringPointDecoder ¶ added in v0.11.0
func NewStringPointDecoder(r io.Reader) *StringPointDecoder
NewStringPointDecoder returns a new instance of StringPointDecoder that reads from r.
func (*StringPointDecoder) DecodeStringPoint ¶ added in v0.11.0
func (dec *StringPointDecoder) DecodeStringPoint(p *StringPoint) error
DecodeStringPoint reads from the underlying reader and unmarshals into p.
func (*StringPointDecoder) Stats ¶ added in v0.12.0
func (dec *StringPointDecoder) Stats() IteratorStats
Stats returns iterator stats embedded within the stream.
type StringPointEmitter ¶ added in v0.11.0
type StringPointEmitter interface {
Emit() []StringPoint
}
StringPointEmitter produces a single point from an aggregate.
type StringPointEncoder ¶ added in v0.11.0
type StringPointEncoder struct {
// contains filtered or unexported fields
}
StringPointEncoder encodes StringPoint points to a writer.
func NewStringPointEncoder ¶ added in v0.11.0
func NewStringPointEncoder(w io.Writer) *StringPointEncoder
NewStringPointEncoder returns a new instance of StringPointEncoder that writes to w.
func (*StringPointEncoder) EncodeStringPoint ¶ added in v0.11.0
func (enc *StringPointEncoder) EncodeStringPoint(p *StringPoint) error
EncodeStringPoint marshals and writes p to the underlying writer.
type StringReduceBooleanFunc ¶ added in v0.11.0
type StringReduceBooleanFunc func(prev *BooleanPoint, curr *StringPoint) (t int64, v bool, aux []interface{})
StringReduceBooleanFunc is the function called by a StringPoint reducer.
type StringReduceBooleanSliceFunc ¶ added in v0.11.0
type StringReduceBooleanSliceFunc func(a []StringPoint) []BooleanPoint
StringReduceBooleanSliceFunc is the function called by a StringPoint reducer.
type StringReduceFloatFunc ¶ added in v0.11.0
type StringReduceFloatFunc func(prev *FloatPoint, curr *StringPoint) (t int64, v float64, aux []interface{})
StringReduceFloatFunc is the function called by a StringPoint reducer.
type StringReduceFloatSliceFunc ¶ added in v0.11.0
type StringReduceFloatSliceFunc func(a []StringPoint) []FloatPoint
StringReduceFloatSliceFunc is the function called by a StringPoint reducer.
type StringReduceFunc ¶ added in v0.11.0
type StringReduceFunc func(prev *StringPoint, curr *StringPoint) (t int64, v string, aux []interface{})
StringReduceFunc is the function called by a StringPoint reducer.
type StringReduceIntegerFunc ¶ added in v0.11.0
type StringReduceIntegerFunc func(prev *IntegerPoint, curr *StringPoint) (t int64, v int64, aux []interface{})
StringReduceIntegerFunc is the function called by a StringPoint reducer.
type StringReduceIntegerSliceFunc ¶ added in v0.11.0
type StringReduceIntegerSliceFunc func(a []StringPoint) []IntegerPoint
StringReduceIntegerSliceFunc is the function called by a StringPoint reducer.
type StringReduceSliceFunc ¶ added in v0.11.0
type StringReduceSliceFunc func(a []StringPoint) []StringPoint
StringReduceSliceFunc is the function called by a StringPoint reducer.
type StringSampleReducer ¶ added in v1.1.1
type StringSampleReducer struct {
// contains filtered or unexported fields
}
StringSampleReducer implements a reservoir sampling to calculate a random subset of points
func NewStringSampleReducer ¶ added in v1.1.1
func NewStringSampleReducer(size int) *StringSampleReducer
NewStringSampleReducer creates a new StringSampleReducer
func (*StringSampleReducer) AggregateString ¶ added in v1.1.1
func (r *StringSampleReducer) AggregateString(p *StringPoint)
AggregateString aggregates a point into the reducer.
func (*StringSampleReducer) Emit ¶ added in v1.1.1
func (r *StringSampleReducer) Emit() []StringPoint
Emit emits the reservoir sample as many points.
type StringSliceFuncBooleanReducer ¶ added in v0.11.0
type StringSliceFuncBooleanReducer struct {
// contains filtered or unexported fields
}
StringSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewStringSliceFuncBooleanReducer ¶ added in v0.11.0
func NewStringSliceFuncBooleanReducer(fn StringReduceBooleanSliceFunc) *StringSliceFuncBooleanReducer
NewStringSliceFuncBooleanReducer creates a new StringSliceFuncBooleanReducer.
func (*StringSliceFuncBooleanReducer) AggregateString ¶ added in v0.11.0
func (r *StringSliceFuncBooleanReducer) AggregateString(p *StringPoint)
AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*StringSliceFuncBooleanReducer) AggregateStringBulk ¶ added in v0.11.0
func (r *StringSliceFuncBooleanReducer) AggregateStringBulk(points []StringPoint)
AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.
func (*StringSliceFuncBooleanReducer) Emit ¶ added in v0.11.0
func (r *StringSliceFuncBooleanReducer) Emit() []BooleanPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type StringSliceFuncFloatReducer ¶ added in v0.11.0
type StringSliceFuncFloatReducer struct {
// contains filtered or unexported fields
}
StringSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewStringSliceFuncFloatReducer ¶ added in v0.11.0
func NewStringSliceFuncFloatReducer(fn StringReduceFloatSliceFunc) *StringSliceFuncFloatReducer
NewStringSliceFuncFloatReducer creates a new StringSliceFuncFloatReducer.
func (*StringSliceFuncFloatReducer) AggregateString ¶ added in v0.11.0
func (r *StringSliceFuncFloatReducer) AggregateString(p *StringPoint)
AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*StringSliceFuncFloatReducer) AggregateStringBulk ¶ added in v0.11.0
func (r *StringSliceFuncFloatReducer) AggregateStringBulk(points []StringPoint)
AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.
func (*StringSliceFuncFloatReducer) Emit ¶ added in v0.11.0
func (r *StringSliceFuncFloatReducer) Emit() []FloatPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type StringSliceFuncIntegerReducer ¶ added in v0.11.0
type StringSliceFuncIntegerReducer struct {
// contains filtered or unexported fields
}
StringSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewStringSliceFuncIntegerReducer ¶ added in v0.11.0
func NewStringSliceFuncIntegerReducer(fn StringReduceIntegerSliceFunc) *StringSliceFuncIntegerReducer
NewStringSliceFuncIntegerReducer creates a new StringSliceFuncIntegerReducer.
func (*StringSliceFuncIntegerReducer) AggregateString ¶ added in v0.11.0
func (r *StringSliceFuncIntegerReducer) AggregateString(p *StringPoint)
AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*StringSliceFuncIntegerReducer) AggregateStringBulk ¶ added in v0.11.0
func (r *StringSliceFuncIntegerReducer) AggregateStringBulk(points []StringPoint)
AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.
func (*StringSliceFuncIntegerReducer) Emit ¶ added in v0.11.0
func (r *StringSliceFuncIntegerReducer) Emit() []IntegerPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type StringSliceFuncReducer ¶ added in v0.11.0
type StringSliceFuncReducer struct {
// contains filtered or unexported fields
}
StringSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.
func NewStringSliceFuncReducer ¶ added in v0.11.0
func NewStringSliceFuncReducer(fn StringReduceSliceFunc) *StringSliceFuncReducer
NewStringSliceFuncReducer creates a new StringSliceFuncReducer.
func (*StringSliceFuncReducer) AggregateString ¶ added in v0.11.0
func (r *StringSliceFuncReducer) AggregateString(p *StringPoint)
AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.
func (*StringSliceFuncReducer) AggregateStringBulk ¶ added in v0.11.0
func (r *StringSliceFuncReducer) AggregateStringBulk(points []StringPoint)
AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.
func (*StringSliceFuncReducer) Emit ¶ added in v0.11.0
func (r *StringSliceFuncReducer) Emit() []StringPoint
Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.
type SubQuery ¶ added in v1.2.1
type SubQuery struct {
Statement *SelectStatement
}
SubQuery is a source with a SelectStatement as the backing store.
type TagSet ¶
TagSet is a fundamental concept within the query system. It represents a composite series, composed of multiple individual series that share a set of tag attributes.
func LimitTagSets ¶ added in v0.11.0
LimitTagSets returns a tag set list with SLIMIT and SOFFSET applied.
type Tags ¶ added in v0.11.0
type Tags struct {
// contains filtered or unexported fields
}
Tags represent a map of keys and values. It memoizes its key so it can be used efficiently during query execution.
type Target ¶
type Target struct { // Measurement to write into. Measurement *Measurement }
Target represents a target (destination) policy, measurement, and DB.
type TaskManager ¶ added in v1.0.0
type TaskManager struct { // Query execution timeout. QueryTimeout time.Duration // Log queries if they are slower than this time. // If zero, slow queries will never be logged. LogQueriesAfter time.Duration // Maximum number of concurrent queries. MaxConcurrentQueries int // Logger to use for all logging. // Defaults to discarding all log output. Logger zap.Logger // contains filtered or unexported fields }
TaskManager takes care of all aspects related to managing running queries.
func NewTaskManager ¶ added in v1.0.0
func NewTaskManager() *TaskManager
NewTaskManager creates a new TaskManager.
func (*TaskManager) AttachQuery ¶ added in v1.0.0
func (t *TaskManager) AttachQuery(q *Query, database string, interrupt <-chan struct{}) (uint64, *QueryTask, error)
AttachQuery attaches a running query to be managed by the TaskManager. Returns the query id of the newly attached query or an error if it was unable to assign a query id or attach the query to the TaskManager. This function also returns a channel that will be closed when this query finishes running.
After a query finishes running, the system is free to reuse a query id.
func (*TaskManager) Close ¶ added in v1.0.0
func (t *TaskManager) Close() error
Close kills all running queries and prevents new queries from being attached.
func (*TaskManager) ExecuteStatement ¶ added in v1.0.0
func (t *TaskManager) ExecuteStatement(stmt Statement, ctx ExecutionContext) error
ExecuteStatement executes a statement containing one of the task management queries.
func (*TaskManager) KillQuery ¶ added in v1.0.0
func (t *TaskManager) KillQuery(qid uint64) error
KillQuery stops and removes a query from the TaskManager. This method can be used to forcefully terminate a running query.
func (*TaskManager) Queries ¶ added in v1.0.0
func (t *TaskManager) Queries() []QueryInfo
Queries returns a list of all running queries with information about them.
type TimeLiteral ¶
TimeLiteral represents a point-in-time literal.
func (*TimeLiteral) String ¶
func (l *TimeLiteral) String() string
String returns a string representation of the literal.
type Token ¶
type Token int
Token is a lexical token of the InfluxQL language.
const ( // ILLEGAL Token, EOF, WS are Special InfluxQL tokens. ILLEGAL Token = iota EOF WS // IDENT and the following are InfluxQL literal tokens. IDENT // main BOUNDPARAM // $param NUMBER // 12345.67 INTEGER // 12345 DURATIONVAL // 13h STRING // "abc" BADSTRING // "abc BADESCAPE // \q TRUE // true FALSE // false REGEX // Regular expressions BADREGEX // `.* // ADD and the following are InfluxQL Operators ADD // + SUB // - MUL // * DIV // / AND // AND OR // OR EQ // = NEQ // != EQREGEX // =~ NEQREGEX // !~ LT // < LTE // <= GT // > GTE // >= LPAREN // ( RPAREN // ) COMMA // , COLON // : DOUBLECOLON // :: SEMICOLON // ; DOT // . // ALL and the following are InfluxQL Keywords ALL ALTER ANY AS ASC BEGIN BY CREATE CONTINUOUS DATABASE DATABASES DEFAULT DELETE DESC DESTINATIONS DIAGNOSTICS DISTINCT DROP DURATION END EVERY EXPLAIN FIELD FOR FROM GRANT GRANTS GROUP GROUPS IN INF INSERT INTO KEY KEYS KILL LIMIT MEASUREMENT MEASUREMENTS NAME OFFSET ON ORDER PASSWORD POLICY POLICIES PRIVILEGES QUERIES QUERY READ REPLICATION RESAMPLE RETENTION REVOKE SELECT SERIES SET SHOW SHARD SHARDS SLIMIT SOFFSET STATS SUBSCRIPTION SUBSCRIPTIONS TAG TO USER USERS VALUES WHERE WITH WRITE )
These are a comprehensive list of InfluxQL language tokens.
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator token.
type TypeMapper ¶ added in v1.2.1
type TypeMapper interface {
MapType(measurement *Measurement, field string) DataType
}
TypeMapper maps a data type to the measurement and field.
type Valuer ¶
type Valuer interface { // Value returns the value and existence flag for a given key. Value(key string) (interface{}, bool) }
Valuer is the interface that wraps the Value() method.
type VarRef ¶
VarRef represents a reference to a variable.
type VarRefs ¶ added in v1.0.0
type VarRefs []VarRef
VarRefs represents a slice of VarRef types.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package influxql is a generated protocol buffer package.
|
Package influxql is a generated protocol buffer package. |
Package neldermead is an implementation of the Nelder-Mead optimization method.
|
Package neldermead is an implementation of the Nelder-Mead optimization method. |