var ( // ErrBadSubstitution represents a substitution parsing error. ErrBadSubstitution = errors.New("bad substitution") // ErrMissingClosingBrace represents a missing closing brace "}" error. ErrMissingClosingBrace = errors.New("missing closing brace") // ErrParseVariableName represents the error when unable to parse a // variable name within a substitution. ErrParseVariableName = errors.New("unable to parse variable name") // ErrParseFuncSubstitution represents the error when unable to parse the // substitution within a function parameter. ErrParseFuncSubstitution = errors.New("unable to parse substitution within function") // ErrParseDefaultFunction represent the error when unable to parse a // default function. ErrParseDefaultFunction = errors.New("unable to parse default function") )
FuncNode represents a string function.
type FuncNode struct { Param string Name string Args []Node }
ListNode represents a list of nodes.
type ListNode struct { Nodes []Node }
Node is an element in the parse tree.
type Node interface {
// contains filtered or unexported methods
}
TextNode represents a string of text.
type TextNode struct { Value string }
Tree is the representation of a single parsed SQL statement.
type Tree struct { Root Node // contains filtered or unexported fields }
func Parse(buf string) (*Tree, error)
Parse parses the string and returns a Tree.
func (t *Tree) Parse(buf string) (tree *Tree, err error)
Parse parses the string buffer to construct an ast representation for expansion.