ast

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryExpr

type BinaryExpr struct {
	Left     Expr
	Operator OpType
	Right    Expr
}

func Binary

func Binary(left Expr, op OpType, right Expr) *BinaryExpr

func (*BinaryExpr) ImplementsExpr

func (e *BinaryExpr) ImplementsExpr()

type Direction

type Direction int
const (
	ASC Direction = iota
	DESC
)

type Expr

type Expr interface {
	ImplementsExpr()
}

type Identifier

type Identifier struct {
	Name   string
	Quoted bool
}

func Name

func Name(name string) *Identifier

func Quoted

func Quoted(name string) *Identifier

func (*Identifier) ImplementsExpr

func (i *Identifier) ImplementsExpr()

type InsertStmt

type InsertStmt struct{}

func (*InsertStmt) ImplementsStmt

func (s *InsertStmt) ImplementsStmt()

type Literal

type Literal struct {
	Raw string
}

func Lit

func Lit(raw string) *Literal

func (*Literal) ImplementsExpr

func (l *Literal) ImplementsExpr()

type OpAssoc

type OpAssoc uint8
const (
	NonAssoc OpAssoc = iota
	LeftAssoc
	RightAssoc
)

func (OpAssoc) String

func (asc OpAssoc) String() string

type OpKind

type OpKind uint8
const (
	Nullary OpKind = iota
	Prefix
	Infix
)

func (OpKind) String

func (kind OpKind) String() string

type OpPrecedence

type OpPrecedence int8
const (
	MinPrecedence OpPrecedence = 0
	MaxPrecedence OpPrecedence = 127
)

type OpType

type OpType int
const (
	NOOP OpType = iota

	// Binary operators
	AND
	OR
	XOR
	IN
	IS
	LIKE
	ILIKE
	REGEXP
	BETWEEN
	OVERLAPS
	LESS
	LESS_OR_EQUAL
	GREATER
	GREATER_OR_EQUAL
	NOT_EQUAL
	EQUAL
	ADD
	SUBTRACT
	MULTIPLY
	DIVIDE
	MODULO
	SHIFT_LEFT
	SHIFT_RIGHT
	BIT_AND
	BIT_OR
	BIT_XOR

	// Unary operators
	NOT
	IS_NULL
	NOT_NULL
	NEGATE
	BIT_NOT
)

type Operator

type Operator struct {
	Literal    string
	Type       OpType
	Kind       OpKind
	Assoc      OpAssoc
	Precedence OpPrecedence
}

type OperatorSet

type OperatorSet struct {
	Literals [3]map[string]Operator
}

func (*OperatorSet) Define

func (os *OperatorSet) Define(op Operator)

func (*OperatorSet) Init

func (os *OperatorSet) Init()

func (*OperatorSet) Lookup

func (os *OperatorSet) Lookup(lit string, kind OpKind) (Operator, bool)

type SelectStmt

type SelectStmt struct {
	Type     SelectType
	Select   []Expr
	Star     bool
	From     *Identifier
	Where    Expr
	Having   Expr
	GroupBy  string
	Grouping Direction
	OrderBy  string
	Ordering Direction
	Limit    int
	Offset   int
}

func (*SelectStmt) ImplementsStmt

func (s *SelectStmt) ImplementsStmt()

type SelectType

type SelectType int
const (
	SELECT_ALL SelectType = iota
	DISTINCT
	DISTINCT_ROW
)

type Stmt

type Stmt interface {
	ImplementsStmt()
}

type UnaryExpr

type UnaryExpr struct {
	Operator OpType
	Subexpr  Expr
}

func Unary

func Unary(op OpType, subexpr Expr) *UnaryExpr

func (*UnaryExpr) ImplementsExpr

func (e *UnaryExpr) ImplementsExpr()

type UnaryOperator

type UnaryOperator int

type UpdateStmt

type UpdateStmt struct{}

func (*UpdateStmt) ImplementsStmt

func (s *UpdateStmt) ImplementsStmt()

Jump to

Keyboard shortcuts

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