statement - ActiveState ActiveGo 1.8
...

Package statement

import "github.com/influxdata/influxdb/stress/v2/stressql/statement"
Overview
Index

Overview ▾

func RandStr

func RandStr(n int) string

RandStr returns a string of random characters with length n

type Parser

Parser turns the file from raw text into an AST

type Parser struct {
    // contains filtered or unexported fields
}

func NewParser

func NewParser(r io.Reader) *Parser

NewParser creates a new Parser

func (*Parser) Parse

func (p *Parser) Parse() (statement.Statement, error)

Parse returns a Statement

func (*Parser) ParseExecStatement

func (p *Parser) ParseExecStatement() (*statement.ExecStatement, error)

ParseExecStatement returns a ExecStatement

func (*Parser) ParseFunction

func (p *Parser) ParseFunction() (*statement.Function, error)

ParseFunction returns a Function

func (*Parser) ParseGoStatement

func (p *Parser) ParseGoStatement() (*statement.GoStatement, error)

ParseGoStatement returns a GoStatement

func (*Parser) ParseInsertStatement

func (p *Parser) ParseInsertStatement() (*statement.InsertStatement, error)

ParseInsertStatement returns a InsertStatement

func (*Parser) ParseQueryStatement

func (p *Parser) ParseQueryStatement() (*statement.QueryStatement, error)

ParseQueryStatement returns a QueryStatement

func (*Parser) ParseSetStatement

func (p *Parser) ParseSetStatement() (*statement.SetStatement, error)

ParseSetStatement returns a SetStatement

func (*Parser) ParseTemplate

func (p *Parser) ParseTemplate() (*statement.Template, error)

ParseTemplate returns a Template

func (*Parser) ParseTimestamp

func (p *Parser) ParseTimestamp() (*statement.Timestamp, error)

ParseTimestamp returns a Timestamp

func (*Parser) ParseWaitStatement

func (p *Parser) ParseWaitStatement() (*statement.WaitStatement, error)

ParseWaitStatement returns a WaitStatement

type Scanner

Scanner scans over the file and converts the raw text into tokens

type Scanner struct {
    // contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader) *Scanner

NewScanner returns a Scanner

func (*Scanner) Scan

func (s *Scanner) Scan() (tok Token, lit string)

Scan moves to the next character in the file and returns a tokenized version as well as the literal

type Token

Token represents a lexical token.

type Token int

The following tokens represent the different values in the AST that make up stressql

const (
    ILLEGAL Token = iota
    EOF

    WS

    // IDENT and the following are InfluxQL literal tokens.
    IDENT       // main
    NUMBER      // 12345.67
    DURATIONVAL // 13h
    STRING      // "abc"
    BADSTRING   // "abc
    TEMPLATEVAR // %f

    COMMA    // ,
    LPAREN   // (
    RPAREN   // )
    LBRACKET // [
    RBRACKET // ]
    PIPE     // |
    PERIOD   // .

    SET
    USE
    QUERY
    INSERT
    GO
    DO
    WAIT
    STR
    INT
    FLOAT
    EXEC
)