sqlparser

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sqlparser provides customizations to the base sql parser that are specific to timeseries (for example, parsing trickster directives from comments)

Index

Constants

This section is empty.

Variables

View Source
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

View Source
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

View Source
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

View Source
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

View Source
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

View Source
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 New

func New(po *parsing.Options) parsing.Parser

New returns a new Time Series SQL Parser

func NewRunContext

NewRunContext returns a context with the Time Range Query and Request Options attached

func ParseComment

func ParseComment(rs *parsing.RunState)

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

func ParseEpoch(input string) (epoch.Epoch, byte, error)

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"

func ParseFVComment

func ParseFVComment(_, _ parsing.Parser, rs *parsing.RunState) parsing.StateFn

ParseFVComment will parse the comment and return FindVerb to be invoked

Types

type Parser

type Parser struct {
	*sql.Parser
}

Parser is a basic, extendable SQL Parser

Jump to

Keyboard shortcuts

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