ast

package
v0.2.26 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aliased

type Aliased struct {
	Toks        []Node
	RealName    Node
	AliasedName Node
	As          Node
	IsAs        bool
}

func (*Aliased) End

func (a *Aliased) End() token.Pos

func (*Aliased) GetAliasedNameIdent

func (a *Aliased) GetAliasedNameIdent() *Identifer

func (*Aliased) GetTokens

func (a *Aliased) GetTokens() []Node

func (*Aliased) Pos

func (a *Aliased) Pos() token.Pos

func (*Aliased) Render

func (a *Aliased) Render(opts *RenderOptions) string

func (*Aliased) SetTokens

func (a *Aliased) SetTokens(toks []Node)

func (*Aliased) String

func (a *Aliased) String() string

func (*Aliased) Type

func (a *Aliased) Type() NodeType

type Comparison

type Comparison struct {
	Toks       []Node
	Left       Node
	Comparison Node
	Right      Node
}

func (*Comparison) End

func (c *Comparison) End() token.Pos

func (*Comparison) GetComparison

func (c *Comparison) GetComparison() Node

func (*Comparison) GetLeft

func (c *Comparison) GetLeft() Node

func (*Comparison) GetRight

func (c *Comparison) GetRight() Node

func (*Comparison) GetTokens

func (c *Comparison) GetTokens() []Node

func (*Comparison) Pos

func (c *Comparison) Pos() token.Pos

func (*Comparison) Render

func (c *Comparison) Render(opts *RenderOptions) string

func (*Comparison) SetTokens

func (c *Comparison) SetTokens(toks []Node)

func (*Comparison) String

func (c *Comparison) String() string

func (*Comparison) Type

func (c *Comparison) Type() NodeType

type FunctionLiteral

type FunctionLiteral struct {
	Toks []Node
}

func (*FunctionLiteral) End

func (fl *FunctionLiteral) End() token.Pos

func (*FunctionLiteral) GetTokens

func (fl *FunctionLiteral) GetTokens() []Node

func (*FunctionLiteral) Pos

func (fl *FunctionLiteral) Pos() token.Pos

func (*FunctionLiteral) Render

func (fl *FunctionLiteral) Render(opts *RenderOptions) string

func (*FunctionLiteral) SetTokens

func (fl *FunctionLiteral) SetTokens(toks []Node)

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) Type

func (fl *FunctionLiteral) Type() NodeType

type Identifer

type Identifer struct {
	Tok *SQLToken
}

func (*Identifer) End

func (i *Identifer) End() token.Pos

func (*Identifer) GetToken

func (i *Identifer) GetToken() *SQLToken

func (*Identifer) IsWildcard

func (i *Identifer) IsWildcard() bool

func (*Identifer) NoQuateString

func (i *Identifer) NoQuateString() string

func (*Identifer) Pos

func (i *Identifer) Pos() token.Pos

func (*Identifer) Render

func (i *Identifer) Render(opts *RenderOptions) string

func (*Identifer) String

func (i *Identifer) String() string

func (*Identifer) Type

func (i *Identifer) Type() NodeType

type IdentiferList

type IdentiferList struct {
	Toks       []Node
	Identifers []Node
	Commas     []Node
}

func (*IdentiferList) End

func (il *IdentiferList) End() token.Pos

func (*IdentiferList) GetIdentifers

func (il *IdentiferList) GetIdentifers() []Node

func (*IdentiferList) GetIndex

func (il *IdentiferList) GetIndex(pos token.Pos) int

func (*IdentiferList) GetTokens

func (il *IdentiferList) GetTokens() []Node

func (*IdentiferList) Pos

func (il *IdentiferList) Pos() token.Pos

func (*IdentiferList) Render

func (il *IdentiferList) Render(opts *RenderOptions) string

func (*IdentiferList) SetTokens

func (il *IdentiferList) SetTokens(toks []Node)

func (*IdentiferList) String

func (il *IdentiferList) String() string

func (*IdentiferList) Type

func (il *IdentiferList) Type() NodeType

type Item

type Item struct {
	Tok *SQLToken
}

func (*Item) End

func (i *Item) End() token.Pos

func (*Item) GetToken

func (i *Item) GetToken() *SQLToken

func (*Item) NoQuateString

func (i *Item) NoQuateString() string

func (*Item) Pos

func (i *Item) Pos() token.Pos

func (*Item) Render

func (i *Item) Render(opts *RenderOptions) string

func (*Item) String

func (i *Item) String() string

func (*Item) Type

func (i *Item) Type() NodeType

type ItemWith

type ItemWith struct {
	Toks []Node
}

func (*ItemWith) End

func (iw *ItemWith) End() token.Pos

func (*ItemWith) GetTokens

func (iw *ItemWith) GetTokens() []Node

func (*ItemWith) Pos

func (iw *ItemWith) Pos() token.Pos

func (*ItemWith) Render

func (iw *ItemWith) Render(opts *RenderOptions) string

func (*ItemWith) SetTokens

func (iw *ItemWith) SetTokens(toks []Node)

func (*ItemWith) String

func (iw *ItemWith) String() string

func (*ItemWith) Type

func (iw *ItemWith) Type() NodeType

type MemberIdentifer

type MemberIdentifer struct {
	Toks        []Node
	Parent      Node
	ParentTok   *SQLToken
	ParentIdent *Identifer
	Child       Node
	ChildTok    *SQLToken
	ChildIdent  *Identifer
}

func NewMemberIdentifer

func NewMemberIdentifer(nodes []Node, parent Node, child Node) *MemberIdentifer

func NewMemberIdentiferParent

func NewMemberIdentiferParent(nodes []Node, parent Node) *MemberIdentifer

func (*MemberIdentifer) End

func (mi *MemberIdentifer) End() token.Pos

func (*MemberIdentifer) GetChild

func (mi *MemberIdentifer) GetChild() Node

func (*MemberIdentifer) GetChildIdent

func (mi *MemberIdentifer) GetChildIdent() *Identifer

func (*MemberIdentifer) GetParent

func (mi *MemberIdentifer) GetParent() Node

func (*MemberIdentifer) GetParentIdent

func (mi *MemberIdentifer) GetParentIdent() *Identifer

func (*MemberIdentifer) GetTokens

func (mi *MemberIdentifer) GetTokens() []Node

func (*MemberIdentifer) Pos

func (mi *MemberIdentifer) Pos() token.Pos

func (*MemberIdentifer) Render

func (mi *MemberIdentifer) Render(opts *RenderOptions) string

func (*MemberIdentifer) SetTokens

func (mi *MemberIdentifer) SetTokens(toks []Node)

func (*MemberIdentifer) String

func (mi *MemberIdentifer) String() string

func (*MemberIdentifer) Type

func (mi *MemberIdentifer) Type() NodeType

type MultiKeyword

type MultiKeyword struct {
	Toks     []Node
	Keywords []Node
}

func (*MultiKeyword) End

func (mk *MultiKeyword) End() token.Pos

func (*MultiKeyword) GetKeywords

func (mk *MultiKeyword) GetKeywords() []Node

func (*MultiKeyword) GetTokens

func (mk *MultiKeyword) GetTokens() []Node

func (*MultiKeyword) Pos

func (mk *MultiKeyword) Pos() token.Pos

func (*MultiKeyword) Render

func (mk *MultiKeyword) Render(opts *RenderOptions) string

func (*MultiKeyword) SetTokens

func (mk *MultiKeyword) SetTokens(toks []Node)

func (*MultiKeyword) String

func (mk *MultiKeyword) String() string

func (*MultiKeyword) Type

func (mk *MultiKeyword) Type() NodeType

type Node

type Node interface {
	String() string
	Render(opts *RenderOptions) string
	Type() NodeType
	Pos() token.Pos
	End() token.Pos
}

func NewItem

func NewItem(tok *token.Token) Node

type NodeType

type NodeType int
const (
	TypeItem NodeType = iota
	TypeMultiKeyword
	TypeMemberIdentifer
	TypeAliased
	TypeIdentifer
	TypeOperator
	TypeComparison
	TypeParenthesis
	TypeParenthesisInner
	TypeFunctionLiteral
	TypeQuery
	TypeStatement
	TypeIdentiferList
	TypeSwitchCase
	TypeNull
)

type Null

type Null struct{}

func (*Null) End

func (n *Null) End() token.Pos

func (*Null) Pos

func (n *Null) Pos() token.Pos

func (*Null) Render

func (n *Null) Render(opts *RenderOptions) string

func (*Null) String

func (n *Null) String() string

func (*Null) Type

func (n *Null) Type() NodeType

type Operator

type Operator struct {
	Toks     []Node
	Left     Node
	Operator Node
	Right    Node
}

func (*Operator) End

func (o *Operator) End() token.Pos

func (*Operator) GetLeft

func (o *Operator) GetLeft() Node

func (*Operator) GetOperator

func (o *Operator) GetOperator() Node

func (*Operator) GetRight

func (o *Operator) GetRight() Node

func (*Operator) GetTokens

func (o *Operator) GetTokens() []Node

func (*Operator) Pos

func (o *Operator) Pos() token.Pos

func (*Operator) Render

func (o *Operator) Render(opts *RenderOptions) string

func (*Operator) SetTokens

func (o *Operator) SetTokens(toks []Node)

func (*Operator) String

func (o *Operator) String() string

func (*Operator) Type

func (o *Operator) Type() NodeType

type Parenthesis

type Parenthesis struct {
	Toks []Node
}

func (*Parenthesis) End

func (p *Parenthesis) End() token.Pos

func (*Parenthesis) GetTokens

func (p *Parenthesis) GetTokens() []Node

func (*Parenthesis) Inner

func (p *Parenthesis) Inner() TokenList

func (*Parenthesis) Pos

func (p *Parenthesis) Pos() token.Pos

func (*Parenthesis) Render

func (p *Parenthesis) Render(opts *RenderOptions) string

func (*Parenthesis) SetTokens

func (p *Parenthesis) SetTokens(toks []Node)

func (*Parenthesis) String

func (p *Parenthesis) String() string

func (*Parenthesis) Type

func (p *Parenthesis) Type() NodeType

type ParenthesisInner

type ParenthesisInner struct {
	Toks []Node
}

func (*ParenthesisInner) End

func (p *ParenthesisInner) End() token.Pos

func (*ParenthesisInner) GetTokens

func (p *ParenthesisInner) GetTokens() []Node

func (*ParenthesisInner) Pos

func (p *ParenthesisInner) Pos() token.Pos

func (*ParenthesisInner) Render

func (p *ParenthesisInner) Render(opts *RenderOptions) string

func (*ParenthesisInner) SetTokens

func (p *ParenthesisInner) SetTokens(toks []Node)

func (*ParenthesisInner) String

func (p *ParenthesisInner) String() string

func (*ParenthesisInner) Type

func (p *ParenthesisInner) Type() NodeType

type Query

type Query struct {
	Toks []Node
}

func (*Query) End

func (q *Query) End() token.Pos

func (*Query) GetTokens

func (q *Query) GetTokens() []Node

func (*Query) Pos

func (q *Query) Pos() token.Pos

func (*Query) Render

func (q *Query) Render(opts *RenderOptions) string

func (*Query) SetTokens

func (q *Query) SetTokens(toks []Node)

func (*Query) String

func (q *Query) String() string

func (*Query) Type

func (q *Query) Type() NodeType

type RenderOptions

type RenderOptions struct {
	LowerCase       bool
	IdentiferQuated bool
}

type SQLToken

type SQLToken struct {
	Node
	Kind  token.Kind
	Value interface{}
	From  token.Pos
	To    token.Pos
}

func NewSQLToken

func NewSQLToken(tok *token.Token) *SQLToken

func (*SQLToken) MatchKind

func (t *SQLToken) MatchKind(expect token.Kind) bool

func (*SQLToken) MatchSQLKeyword

func (t *SQLToken) MatchSQLKeyword(expect string) bool

func (*SQLToken) MatchSQLKeywords

func (t *SQLToken) MatchSQLKeywords(expects []string) bool

func (*SQLToken) MatchSQLKind

func (t *SQLToken) MatchSQLKind(expect dialect.KeywordKind) bool

func (*SQLToken) NoQuateString

func (t *SQLToken) NoQuateString() string

func (*SQLToken) Render

func (t *SQLToken) Render(opts *RenderOptions) string

func (*SQLToken) String

func (t *SQLToken) String() string

type Statement

type Statement struct {
	Toks []Node
}

func (*Statement) End

func (s *Statement) End() token.Pos

func (*Statement) GetTokens

func (s *Statement) GetTokens() []Node

func (*Statement) Pos

func (s *Statement) Pos() token.Pos

func (*Statement) Render

func (s *Statement) Render(opts *RenderOptions) string

func (*Statement) SetTokens

func (s *Statement) SetTokens(toks []Node)

func (*Statement) String

func (s *Statement) String() string

func (*Statement) Type

func (s *Statement) Type() NodeType

type SwitchCase

type SwitchCase struct {
	Toks []Node
}

func (*SwitchCase) End

func (sc *SwitchCase) End() token.Pos

func (*SwitchCase) GetTokens

func (sc *SwitchCase) GetTokens() []Node

func (*SwitchCase) Pos

func (sc *SwitchCase) Pos() token.Pos

func (*SwitchCase) Render

func (sc *SwitchCase) Render(opts *RenderOptions) string

func (*SwitchCase) SetTokens

func (sc *SwitchCase) SetTokens(toks []Node)

func (*SwitchCase) String

func (sc *SwitchCase) String() string

func (*SwitchCase) Type

func (sc *SwitchCase) Type() NodeType

type Token

type Token interface {
	Node
	GetToken() *SQLToken
}

type TokenList

type TokenList interface {
	Node
	GetTokens() []Node
	SetTokens([]Node)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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