parser

package
v1.1.0-beta.0...-9815b45 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPatternNotMatch represents an error that patterns doesn't match.
	ErrPatternNotMatch = errors.New("Pattern not match")
)

Functions

func AnyChar

func AnyChar(buf string) (string, error)

AnyChar matches an arbitrary character

func AnyPunct

func AnyPunct(buf string) (string, error)

AnyPunct matches an arbitrary punctuation

func Char

func Char(buf string, c byte) (string, error)

Char matches a character: c

func Digit

func Digit(buf string, times int) (match string, rest string, err error)

Digit matches at least `times` digits

func GetDefaultDB

func GetDefaultDB(sel ast.StmtNode, dbName string) string

GetDefaultDB checks if all tables in the AST have explicit DBName. If not, return specified DBName.

func Match

func Match(buf string, pat func(byte) bool, times int) (match string, rest string, err error)

Match matches the `pat` at least `times`, and returns the match, the rest and the error

func MatchOne

func MatchOne(buf string, pat func(byte) bool) (string, error)

MatchOne matches only one time with pat

func Number

func Number(str string) (int, string, error)

Number matches a series of digits and convert it to an int

func RestoreWithDefaultDB

func RestoreWithDefaultDB(node ast.StmtNode, defaultDB, origin string) string

RestoreWithDefaultDB returns restore strings for StmtNode with defaultDB This function is customized for SQL bind usage.

func SimpleCases

func SimpleCases(node ast.StmtNode, defaultDB, origin string) (s string, ok bool)

SimpleCases captures simple SQL statements and uses string replacement instead of `restore` to improve performance. See https://github.com/pingcap/tidb/issues/22398.

func Space

func Space(buf string, times int) (string, error)

Space matches at least `times` spaces

func Space0

func Space0(buf string) string

Space0 matches at least 0 space.

Types

This section is empty.

Jump to

Keyboard shortcuts

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