expr

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 7 modules, 19 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identity

func Identity(node node.Node) node.Node

Identity returns ident or selector expr

func NewSelector

func NewSelector(name string) node.Node

NewSelector returns

Types

type Binary

type Binary struct {
	X, Y node.Node
	Op   string
}

Binary represents binary expr

func NewBinary

func NewBinary(x node.Node) *Binary

NewBinary returns a binary expr

func (*Binary) HasIdentifier added in v0.3.0

func (b *Binary) HasIdentifier() bool

HasIdentifier returns true if x or y opperand is identity

func (*Binary) HasPlaceholder

func (b *Binary) HasPlaceholder() bool

HasPlaceholder returns true if x or y operand is placeholder

func (*Binary) Ident added in v0.7.1

func (b *Binary) Ident() *Ident

func (*Binary) Identifier added in v0.3.0

func (b *Binary) Identifier() node.Node

Identifier returns an identifier node or nil

func (*Binary) Normalize added in v0.7.1

func (b *Binary) Normalize() *Binary

func (*Binary) Parenthesis

func (b *Binary) Parenthesis() *Parenthesis

Parenthesis returns parenthesis

func (*Binary) Placeholder added in v0.7.0

func (b *Binary) Placeholder() *Placeholder

Placeholder returns placeholder

func (*Binary) Predicate added in v0.7.0

func (b *Binary) Predicate() (node.Node, *Values, error)

Predicate binary predicate or nil

func (*Binary) SelectorIdent added in v0.7.1

func (b *Binary) SelectorIdent(root string) *Ident

func (*Binary) Values added in v0.7.0

func (b *Binary) Values() (*Values, error)

Values returns expression values

func (*Binary) Walk added in v0.7.0

func (b *Binary) Walk(fn func(ident node.Node, values *Values, operator, parentOperator string) error) error

type Call

type Call struct {
	X    node.Node
	Args []node.Node
	Raw  string
}

Call represents a call. Named arguments are *Binary nodes with Op "=>", a *Raw argument name in X, and the argument expression in Y.

type Case

type Case struct {
	X Qualify
	Y node.Node
}

Case represents a WHEN condition (X) and THEN result (Y). A first entry with only X holds a simple CASE selector; an entry with only Y holds ELSE. This keeps all expressions traversable without changing the public Switch or Case field layout.

type Collate added in v0.10.0

type Collate struct {
	X         node.Node
	Collation string
}

Collate represents collate expression.

type FieldAccess added in v0.13.1

type FieldAccess struct {
	X    node.Node
	Name string
}

FieldAccess selects a field of a computed value, such as an array element.

type Ident

type Ident struct {
	Name string
}

Ident represent an identifier

type Literal

type Literal struct {
	Value string
	Kind  string
}

Literal represents a literal

func NewBoolLiteral

func NewBoolLiteral(v string) *Literal

NewBoolLiteral returns bool literal

func NewIntLiteral

func NewIntLiteral(v string) *Literal

NewIntLiteral returns an int literal

func NewNullLiteral

func NewNullLiteral(v string) *Literal

NewNullLiteral returns null literal

func NewNumericLiteral

func NewNumericLiteral(v string) *Literal

NewNumericLiteral returns numeric literal

func NewStringLiteral

func NewStringLiteral(v string) *Literal

NewStringLiteral returns string literal

type NullTreatment added in v0.13.1

type NullTreatment struct {
	X    node.Node
	Mode string
}

NullTreatment applies IGNORE NULLS or RESPECT NULLS to an aggregate argument.

type Parenthesis

type Parenthesis struct {
	Raw string
	X   node.Node
}

Parenthesis represents parenthesis expr

func NewParenthesis

func NewParenthesis(raw string) *Parenthesis

NewParenthesis returns a parenthesis expr

type Placeholder

type Placeholder struct {
	Name     string
	Comments string
}

Placeholder represetns a placeholder

func NewPlaceholder

func NewPlaceholder(name string) *Placeholder

NewPlaceholder returns a placeholder

type Qualify

type Qualify struct {
	X node.Node
}

Qualify represents qualify node

func NewQualify

func NewQualify() *Qualify

NewQualify returns qualify node

type Range

type Range struct {
	Min node.Node
	Max node.Node
}

Range represents a range expr

type Raw

type Raw struct {
	Raw      string
	X        node.Node
	Unparsed string
}

Raw represetns a raw expr

func NewRaw

func NewRaw(raw string) *Raw

NewRaw create a raw valie

type Selector

type Selector struct {
	Name       string
	Expression string
	X          node.Node
}

Selector represent identifier selector

type Star

type Star struct {
	X        node.Node
	Except   []string
	Comments string
}

Star represents a star expr

func NewStar

func NewStar(x node.Node, comments string) *Star

NewStar returns a start expr

type Subscript added in v0.13.1

type Subscript struct {
	X     node.Node
	Index node.Node
}

Subscript accesses an element of X using an index expression.

type Switch

type Switch struct {
	Raw string
	Ident
	Cases []*Case
}

Switch represetns a switch expr

type Unary

type Unary struct {
	Op string
	X  node.Node
}

Unary represents unary expr

func NewUnary

func NewUnary(op string) *Unary

NewUnary crates an unary expr

type Value added in v0.7.0

type Value struct {
	Placeholder bool
	Raw         string
	Value       interface{}
	Kind        string
}

Value represents predicate value

func NewValue added in v0.7.1

func NewValue(raw string) (*Value, error)

func (*Value) AsInt added in v0.7.1

func (v *Value) AsInt() (int, bool)

type Values added in v0.7.0

type Values struct {
	Idx int
	X   []Value
}

func NewValues added in v0.7.0

func NewValues(n node.Node) (*Values, error)

NewValues creates predicate values

func (*Values) Values added in v0.7.1

func (v *Values) Values(placeholderProvider func(idx int) interface{}) []interface{}

Values returns values

type Window added in v0.13.1

type Window struct {
	X           node.Node
	PartitionBy []node.Node
	OrderBy     []*WindowOrder
	Frame       *WindowFrame
}

Window is a function call with an inline OVER specification.

type WindowBound added in v0.13.1

type WindowBound struct {
	X    node.Node
	Kind string
}

WindowBound is CURRENT ROW, UNBOUNDED PRECEDING/FOLLOWING, or an offset bound.

type WindowFrame added in v0.13.1

type WindowFrame struct {
	Unit       string
	Start, End *WindowBound
}

WindowFrame represents ROWS or RANGE, with an optional BETWEEN end bound.

type WindowOrder added in v0.13.1

type WindowOrder struct {
	X         node.Node
	Direction string
}

WindowOrder is an expression and its optional ASC/DESC direction.

Jump to

Keyboard shortcuts

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