Documentation
¶
Overview ¶
Package sqlparser provides customizations to the base sql parser that are specific to timeseries (for example, parsing trickster directives from comments)
Index ¶
- Variables
- func ArtifactsFromContext(ctx context.Context) (*timeseries.TimeRangeQuery, *timeseries.RequestOptions)
- func New(po *parsing.Options) parsing.Parser
- func NewRunContext(trq *timeseries.TimeRangeQuery, ro *timeseries.RequestOptions) context.Context
- func ParseComment(rs *parsing.RunState)
- func ParseEpoch(input string) (epoch.Epoch, byte, error)
- func ParseFVComment(_, _ parsing.Parser, rs *parsing.RunState) parsing.StateFn
- type Parser
Constants ¶
This section is empty.
Variables ¶
var ErrMissingTimeseries = errors.New("no timeseries tokens found in SELECT fields")
ErrMissingTimeseries is an error for when the query does not include timeseries-specific tokens
var ErrNoLowerBound = errors.New("no lower bound found in time range query")
ErrNoLowerBound is an error used when the lower bound is missing from the time range query
var ErrNoUpperBound = errors.New("no upper bound found in time range query")
ErrNoUpperBound is an error used when the upper bound is missing from the time range query
var ErrNotTimeRangeQuery = errors.New("query could not be identified as a time range query")
ErrNotTimeRangeQuery is an error used when the query does not appear to be a time range for a series
var ErrStepParse = errors.New("unable to parse step duration")
ErrStepParse indicates the Time Range Query's step value could not be parsed from the input
var ErrTimerangeParse = errors.New("unable to parse time range")
ErrTimerangeParse indicates the Time Range could not be parsed from the query
Functions ¶
func ArtifactsFromContext ¶
func ArtifactsFromContext(ctx context.Context) (*timeseries.TimeRangeQuery, *timeseries.RequestOptions)
ArtifactsFromContext returns the Time Range Query and Request Options from the context, if present
func NewRunContext ¶
func NewRunContext(trq *timeseries.TimeRangeQuery, ro *timeseries.RequestOptions) context.Context
NewRunContext returns a context with the Time Range Query and Request Options attached
func ParseComment ¶
ParseComment will parse the comment for Trickster time range query directives such as Fast Forward Disable or a Backfill Tolerance value. It assumes the RunState is currently on the Comment Token
func ParseEpoch ¶
ParseEpoch accepts the following formats, and returns an epoch.Epoch (NS since 1-1-1970): typ 0 - 10-digit epoch in seconds: "1577836800" typ 1 - 13-digit epoch in millisecons: "1577836800000" typ 2 - SQL DateTime: "2020-01-01 00:00:00" typ 3 - SQL Date: "2020-01-01"