expr

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 7

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

type Case

type Case struct {
	X Qualify
	Y node.Node
}

Case represents a switch case

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

Jump to

Keyboard shortcuts

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