syntax

package
v0.0.0-...-dfe0916 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CStringStrip

func CStringStrip(s string) string

func NewParserError

func NewParserError(sql string, err error) error

NewParserError parse error message of TiDB parser error, with SQL statement and hint.

Types

type Node

type Node struct {
	ast.Node

	Parent     *Node
	Children   []*Node
	IsConstant bool
}

Node is a wrap for ast.Node, add pointers to parent and children

func (*Node) AllChildrenConstant

func (n *Node) AllChildrenConstant() bool

func (*Node) Info

func (n *Node) Info() string

func (*Node) Last

func (n *Node) Last() *Node

func (*Node) Message

func (n *Node) Message() string

func (*Node) NewChild

func (n *Node) NewChild(node ast.Node) *Node

func (*Node) PrintTree

func (n *Node) PrintTree(level int, lead string, last bool)

func (*Node) TypeEqual

func (n *Node) TypeEqual(other *Node) bool

func (*Node) VerifyConstant

func (n *Node) VerifyConstant()

type Parser

type Parser struct {
	StripCString bool
	// contains filtered or unexported fields
}

Parser is a TiDB parser and its configures

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(sql string) ([]*Node, []error, error)

Parse parses a SQL statement and returns a syntax trees.

type ParserError

type ParserError struct {
	Line   int
	Column int
	SQL    string
	Err    error
}

ParserError parse error message of TiDB parser error

func (*ParserError) Error

func (e *ParserError) Error() string

func (*ParserError) Hint

func (e *ParserError) Hint() string

func (*ParserError) Unwrap

func (e *ParserError) Unwrap() error

type Visitor

type Visitor struct {
	Level int
	Root  *Node
	Node  *Node
}

func NewVisitor

func NewVisitor() *Visitor

func (*Visitor) Enter

func (v *Visitor) Enter(in ast.Node) (ast.Node, bool)

func (*Visitor) Lead

func (v *Visitor) Lead() string

func (*Visitor) Leave

func (v *Visitor) Leave(in ast.Node) (ast.Node, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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