ast

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package ast is the abstract syntax tree parsed from a SQL statement by parser. It can be analysed and transformed by optimizer.

Index

Constants

View Source
const (
	KindNull          byte = 0
	KindInt64         byte = 1
	KindUint64        byte = 2
	KindFloat32       byte = 3
	KindFloat64       byte = 4
	KindString        byte = 5
	KindBytes         byte = 6
	KindBinaryLiteral byte = 7 // Used for BIT / HEX literals.
	KindMysqlDecimal  byte = 8
	KindMysqlDuration byte = 9
	KindMysqlEnum     byte = 10
	KindMysqlBit      byte = 11 // Used for BIT table column values.
	KindMysqlSet      byte = 12
	KindMysqlTime     byte = 13
	KindInterface     byte = 14
	KindMinNotNull    byte = 15
	KindMaxValue      byte = 16
	KindRaw           byte = 17
	KindMysqlJSON     byte = 18
)

Kind constants.

View Source
const (
	RowFormatDefault uint64 = iota + 1
	RowFormatDynamic
	RowFormatFixed
	RowFormatCompressed
	RowFormatRedundant
	RowFormatCompact
)

RowFormat types

View Source
const (
	TableOptionCharsetWithoutConvertTo uint64 = 0
	TableOptionCharsetWithConvertTo    uint64 = 1
)
View Source
const (
	// TableAffinityLevelNone means no affinity.
	TableAffinityLevelNone = "none"
	// TableAffinityLevelTable means table-level affinity.
	TableAffinityLevelTable = "table"
	// TableAffinityLevelPartition means partition-level affinity.
	TableAffinityLevelPartition = "partition"
)
View Source
const (
	Terminated = iota
	Enclosed
	Escaped
	DefinedNullBy
)
View Source
const (
	ShowNone = iota
	ShowEngines
	ShowDatabases
	ShowTables
	ShowTableStatus
	ShowColumns
	ShowWarnings
	ShowCharset
	ShowVariables
	ShowStatus
	ShowCollation
	ShowCreateTable
	ShowCreateView
	ShowCreateUser
	ShowGrants
	ShowTriggers
	ShowIndex
	ShowProcessList
	ShowCreateDatabase
	ShowEvents
	ShowPlugins
	ShowProfile
	ShowProfiles
	ShowMasterStatus
	ShowPrivileges
	ShowErrors
	ShowOpenTables
	ShowBinlogStatus
	ShowReplicaStatus
	ShowBinaryLogs
	ShowBinlogEvents
	ShowReplicas
	ShowCreateProcedure
	ShowCreateFunction
	ShowCreateTrigger
	ShowCreateEvent
	ShowCreateLibrary
	ShowProcedureStatus
	ShowFunctionStatus
	ShowLibraryStatus
	ShowProcedureCode
	ShowFunctionCode
	ShowParseTree
	ShowEngineStatus
	ShowEngineLogs
	ShowEngineMutex
	ShowRelaylogEvents
)

Show statement types.

View Source
const (
	ProfileTypeInvalid = iota
	ProfileTypeCPU
	ProfileTypeMemory
	ProfileTypeBlockIo
	ProfileTypeContextSwitch
	ProfileTypePageFaults
	ProfileTypeIpc
	ProfileTypeSwaps
	ProfileTypeSource
	ProfileTypeAll
)
View Source
const (
	Rows = iota
	Ranges
	Groups
)

Window function frame types. MySQL only supports `ROWS` and `RANGES`.

View Source
const (
	Following = iota
	Preceding
	CurrentRow
)

Frame bound types.

View Source
const (
	FulltextSearchModifierNaturalLanguageMode = 0
	FulltextSearchModifierBooleanMode         = 1
	FulltextSearchModifierModeMask            = 0xF
	FulltextSearchModifierWithQueryExpansion  = 1 << 4
)
View Source
const (
	LogicAnd           = "and"
	Cast               = "cast"
	LeftShift          = "leftshift"
	RightShift         = "rightshift"
	LogicOr            = "or"
	GE                 = "ge"
	LE                 = "le"
	EQ                 = "eq"
	NE                 = "ne"
	LT                 = "lt"
	GT                 = "gt"
	Plus               = "plus"
	Minus              = "minus"
	And                = "bitand"
	Or                 = "bitor"
	Mod                = "mod"
	Xor                = "bitxor"
	Div                = "div"
	Mul                = "mul"
	UnaryNot           = "not" // Avoid name conflict with Not in github/pingcap/check.
	BitNeg             = "bitneg"
	IntDiv             = "intdiv"
	LogicXor           = "xor"
	NullEQ             = "nulleq"
	UnaryPlus          = "unaryplus"
	UnaryMinus         = "unaryminus"
	In                 = "in"
	Like               = "like"
	Case               = "case"
	Regexp             = "regexp"
	RegexpLike         = "regexp_like"
	RegexpSubstr       = "regexp_substr"
	RegexpInStr        = "regexp_instr"
	RegexpReplace      = "regexp_replace"
	IsNull             = "isnull"
	IsTruthWithoutNull = "istrue" // Avoid name conflict with IsTrue in github/pingcap/check.
	IsTruthWithNull    = "istrue_with_null"
	IsFalsity          = "isfalse" // Avoid name conflict with IsFalse in github/pingcap/check.
	RowFunc            = "row"
	SetVar             = "setvar"
	GetVar             = "getvar"
	Values             = "values"
	BitCount           = "bit_count"
	GetParam           = "getparam"

	// common functions
	Coalesce = "coalesce"
	Greatest = "greatest"
	Least    = "least"
	Interval = "interval"

	// masking functions
	MaskFull    = "mask_full"
	MaskPartial = "mask_partial"
	MaskNull    = "mask_null"
	MaskDate    = "mask_date"

	// math functions
	Abs      = "abs"
	Acos     = "acos"
	Asin     = "asin"
	Atan     = "atan"
	Atan2    = "atan2"
	Ceil     = "ceil"
	Ceiling  = "ceiling"
	Conv     = "conv"
	Cos      = "cos"
	Cot      = "cot"
	CRC32    = "crc32"
	Degrees  = "degrees"
	Exp      = "exp"
	Floor    = "floor"
	Ln       = "ln"
	Log      = "log"
	Log2     = "log2"
	Log10    = "log10"
	PI       = "pi"
	Pow      = "pow"
	Power    = "power"
	Radians  = "radians"
	Rand     = "rand"
	Round    = "round"
	Sign     = "sign"
	Sin      = "sin"
	Sqrt     = "sqrt"
	Tan      = "tan"
	Truncate = "truncate"

	// time functions
	AddDate          = "adddate"
	AddTime          = "addtime"
	ConvertTz        = "convert_tz"
	Curdate          = "curdate"
	CurrentDate      = "current_date"
	CurrentTime      = "current_time"
	CurrentTimestamp = "current_timestamp"
	Curtime          = "curtime"
	Date             = "date"
	DateLiteral      = "'spirit`.(dateliteral"
	DateAdd          = "date_add"
	DateFormat       = "date_format"
	DateSub          = "date_sub"
	DateDiff         = "datediff"
	Day              = "day"
	DayName          = "dayname"
	DayOfMonth       = "dayofmonth"
	DayOfWeek        = "dayofweek"
	DayOfYear        = "dayofyear"
	Extract          = "extract"
	FromDays         = "from_days"
	FromUnixTime     = "from_unixtime"
	GetFormat        = "get_format"
	Hour             = "hour"
	LocalTime        = "localtime"
	LocalTimestamp   = "localtimestamp"
	MakeDate         = "makedate"
	MakeTime         = "maketime"
	MicroSecond      = "microsecond"
	Minute           = "minute"
	Month            = "month"
	MonthName        = "monthname"
	Now              = "now"
	PeriodAdd        = "period_add"
	PeriodDiff       = "period_diff"
	Quarter          = "quarter"
	SecToTime        = "sec_to_time"
	Second           = "second"
	StrToDate        = "str_to_date"
	SubDate          = "subdate"
	SubTime          = "subtime"
	Sysdate          = "sysdate"
	Time             = "time"
	TimeLiteral      = "'spirit`.(timeliteral"
	TimeFormat       = "time_format"
	TimeToSec        = "time_to_sec"
	TimeDiff         = "timediff"
	Timestamp        = "timestamp"
	TimestampLiteral = "'spirit`.(timestampliteral"
	TimestampAdd     = "timestampadd"
	TimestampDiff    = "timestampdiff"
	ToDays           = "to_days"
	ToSeconds        = "to_seconds"
	UnixTimestamp    = "unix_timestamp"
	UTCDate          = "utc_date"
	UTCTime          = "utc_time"
	UTCTimestamp     = "utc_timestamp"
	Week             = "week"
	Weekday          = "weekday"
	WeekOfYear       = "weekofyear"
	Year             = "year"
	YearWeek         = "yearweek"
	LastDay          = "last_day"
	// string functions
	ASCII           = "ascii"
	Bin             = "bin"
	Concat          = "concat"
	ConcatWS        = "concat_ws"
	Convert         = "convert"
	Elt             = "elt"
	ExportSet       = "export_set"
	Field           = "field"
	Format          = "format"
	FromBase64      = "from_base64"
	InsertFunc      = "insert_func"
	Instr           = "instr"
	Lcase           = "lcase"
	Left            = "left"
	Length          = "length"
	LoadFile        = "load_file"
	Locate          = "locate"
	Lower           = "lower"
	Lpad            = "lpad"
	LTrim           = "ltrim"
	MakeSet         = "make_set"
	Mid             = "mid"
	Oct             = "oct"
	OctetLength     = "octet_length"
	Ord             = "ord"
	Position        = "position"
	Quote           = "quote"
	Repeat          = "repeat"
	Replace         = "replace"
	Reverse         = "reverse"
	Right           = "right"
	RTrim           = "rtrim"
	Space           = "space"
	Strcmp          = "strcmp"
	Substring       = "substring"
	Substr          = "substr"
	SubstringIndex  = "substring_index"
	ToBase64        = "to_base64"
	Trim            = "trim"
	Translate       = "translate"
	Upper           = "upper"
	Ucase           = "ucase"
	Hex             = "hex"
	Unhex           = "unhex"
	Rpad            = "rpad"
	BitLength       = "bit_length"
	CharFunc        = "char_func"
	CharLength      = "char_length"
	CharacterLength = "character_length"
	FindInSet       = "find_in_set"
	WeightString    = "weight_string"
	Soundex         = "soundex"

	// information functions
	Benchmark    = "benchmark"
	Charset      = "charset"
	Coercibility = "coercibility"
	Collation    = "collation"
	ConnectionID = "connection_id"
	CurrentUser  = "current_user"
	CurrentRole  = "current_role"
	Database     = "database"
	FoundRows    = "found_rows"
	LastInsertId = "last_insert_id"
	RowCount     = "row_count"
	Schema       = "schema"
	SessionUser  = "session_user"
	SystemUser   = "system_user"
	User         = "user"
	Version      = "version"
	FormatBytes  = "format_bytes"

	// control functions
	If     = "if"
	Ifnull = "ifnull"
	Nullif = "nullif"

	// miscellaneous functions
	AnyValue        = "any_value"
	DefaultFunc     = "default_func"
	InetAton        = "inet_aton"
	InetNtoa        = "inet_ntoa"
	Inet6Aton       = "inet6_aton"
	Inet6Ntoa       = "inet6_ntoa"
	IsFreeLock      = "is_free_lock"
	IsIPv4          = "is_ipv4"
	IsIPv4Compat    = "is_ipv4_compat"
	IsIPv4Mapped    = "is_ipv4_mapped"
	IsIPv6          = "is_ipv6"
	IsUsedLock      = "is_used_lock"
	IsUUID          = "is_uuid"
	NameConst       = "name_const"
	ReleaseAllLocks = "release_all_locks"
	Sleep           = "sleep"
	UUID            = "uuid"
	UUIDv4          = "uuid_v4"
	UUIDv7          = "uuid_v7"
	UUIDVersion     = "uuid_version"
	UUIDTimestamp   = "uuid_timestamp"
	UUIDShort       = "uuid_short"
	UUIDToBin       = "uuid_to_bin"
	BinToUUID       = "bin_to_uuid"
	GetLock         = "get_lock"
	ReleaseLock     = "release_lock"
	Grouping        = "grouping"

	// encryption and compression functions
	AesDecrypt               = "aes_decrypt"
	AesEncrypt               = "aes_encrypt"
	Compress                 = "compress"
	Decode                   = "decode"
	Encode                   = "encode"
	MD5                      = "md5"
	PasswordFunc             = "password"
	RandomBytes              = "random_bytes"
	SHA1                     = "sha1"
	SHA                      = "sha"
	SHA2                     = "sha2"
	SM3                      = "sm3"
	Uncompress               = "uncompress"
	UncompressedLength       = "uncompressed_length"
	ValidatePasswordStrength = "validate_password_strength"

	// json functions
	JSONType          = "json_type"
	JSONExtract       = "json_extract"
	JSONUnquote       = "json_unquote"
	JSONArray         = "json_array"
	JSONObject        = "json_object"
	JSONMerge         = "json_merge"
	JSONSet           = "json_set"
	JSONSumCrc32      = "json_sum_crc32"
	JSONInsert        = "json_insert"
	JSONReplace       = "json_replace"
	JSONRemove        = "json_remove"
	JSONOverlaps      = "json_overlaps"
	JSONContains      = "json_contains"
	JSONMemberOf      = "json_memberof"
	JSONContainsPath  = "json_contains_path"
	JSONValid         = "json_valid"
	JSONArrayAppend   = "json_array_append"
	JSONArrayInsert   = "json_array_insert"
	JSONMergePatch    = "json_merge_patch"
	JSONMergePreserve = "json_merge_preserve"
	JSONPretty        = "json_pretty"
	JSONQuote         = "json_quote"
	JSONSchemaValid   = "json_schema_valid"
	JSONSearch        = "json_search"
	JSONStorageFree   = "json_storage_free"
	JSONStorageSize   = "json_storage_size"
	JSONDepth         = "json_depth"
	JSONKeys          = "json_keys"
	JSONLength        = "json_length"
)

List scalar function names.

View Source
const (
	// AggFuncCount is the name of Count function.
	AggFuncCount = "count"
	// AggFuncSum is the name of Sum function.
	AggFuncSum = "sum"
	// AggFuncAvg is the name of Avg function.
	AggFuncAvg = "avg"
	// AggFuncFirstRow is the name of FirstRowColumn function.
	AggFuncFirstRow = "firstrow"
	// AggFuncMax is the name of max function.
	AggFuncMax = "max"
	// AggFuncMin is the name of min function.
	AggFuncMin = "min"
	// AggFuncGroupConcat is the name of group_concat function.
	AggFuncGroupConcat = "group_concat"
	// AggFuncBitOr is the name of bit_or function.
	AggFuncBitOr = "bit_or"
	// AggFuncBitXor is the name of bit_xor function.
	AggFuncBitXor = "bit_xor"
	// AggFuncBitAnd is the name of bit_and function.
	AggFuncBitAnd = "bit_and"
	// AggFuncVarPop is the name of var_pop function
	AggFuncVarPop = "var_pop"
	// AggFuncVarSamp is the name of var_samp function
	AggFuncVarSamp = "var_samp"
	// AggFuncStddevPop is the name of stddev_pop/std/stddev function
	AggFuncStddevPop = "stddev_pop"
	// AggFuncStddevSamp is the name of stddev_samp function
	AggFuncStddevSamp = "stddev_samp"
	// AggFuncJsonArrayagg is the name of json_arrayagg function
	AggFuncJsonArrayagg = "json_arrayagg"
	// AggFuncJsonObjectAgg is the name of json_objectagg function
	AggFuncJsonObjectAgg = "json_objectagg"
	// AggFuncApproxCountDistinct is the name of approx_count_distinct function.
	AggFuncApproxCountDistinct = "approx_count_distinct"
	// AggFuncApproxPercentile is the name of approx_percentile function.
	AggFuncApproxPercentile = "approx_percentile"
)
View Source
const (
	// WindowFuncRowNumber is the name of row_number function.
	WindowFuncRowNumber = "row_number"
	// WindowFuncRank is the name of rank function.
	WindowFuncRank = "rank"
	// WindowFuncDenseRank is the name of dense_rank function.
	WindowFuncDenseRank = "dense_rank"
	// WindowFuncCumeDist is the name of cume_dist function.
	WindowFuncCumeDist = "cume_dist"
	// WindowFuncPercentRank is the name of percent_rank function.
	WindowFuncPercentRank = "percent_rank"
	// WindowFuncNtile is the name of ntile function.
	WindowFuncNtile = "ntile"
	// WindowFuncLead is the name of lead function.
	WindowFuncLead = "lead"
	// WindowFuncLag is the name of lag function.
	WindowFuncLag = "lag"
	// WindowFuncFirstValue is the name of first_value function.
	WindowFuncFirstValue = "first_value"
	// WindowFuncLastValue is the name of last_value function.
	WindowFuncLastValue = "last_value"
	// WindowFuncNthValue is the name of nth_value function.
	WindowFuncNthValue = "nth_value"
)
View Source
const (
	ReadCommitted   = "READ-COMMITTED"
	ReadUncommitted = "READ-UNCOMMITTED"
	Serializable    = "SERIALIZABLE"
	RepeatableRead  = "REPEATABLE-READ"
)

Isolation level constants.

View Source
const (
	// SetNames is the const for set names stmt.
	// If VariableAssignment.Name == Names, it should be set names stmt.
	SetNames = "SetNAMES"
	// SetCharset is the const for set charset stmt.
	SetCharset = "SetCharset"
)
View Source
const (
	MaxQueriesPerHour = iota + 1
	MaxUpdatesPerHour
	MaxConnectionsPerHour
	MaxUserConnections
)
View Source
const (
	PasswordExpire = iota + 1
	PasswordExpireDefault
	PasswordExpireNever
	PasswordExpireInterval
	PasswordHistory
	PasswordHistoryDefault
	PasswordReuseInterval
	PasswordReuseDefault
	Lock
	Unlock
	FailedLoginAttempts
	PasswordLockTime
	PasswordLockTimeUnbounded
	UserCommentType
	UserAttributeType
	PasswordRequireCurrentDefault
	PasswordRequireCurrent
	PasswordRequireCurrentOptional

	UserResourceGroupName
)
View Source
const (
	LowPriorityValue    = 1
	MediumPriorityValue = 8
	HighPriorityValue   = 16
)

Priority values.

View Source
const DefaultFsp = int8(0)

DefaultFsp is the default digit of fractional seconds part. MySQL use 0 as the default Fsp.

Variables

View Source
var (
	ErrNoParts                      = mysql.NewStdErr("ddl", mysql.ErrNoParts)
	ErrPartitionColumnList          = mysql.NewStdErr("ddl", mysql.ErrPartitionColumnList)
	ErrPartitionRequiresValues      = mysql.NewStdErr("ddl", mysql.ErrPartitionRequiresValues)
	ErrPartitionsMustBeDefined      = mysql.NewStdErr("ddl", mysql.ErrPartitionsMustBeDefined)
	ErrPartitionWrongNoPart         = mysql.NewStdErr("ddl", mysql.ErrPartitionWrongNoPart)
	ErrPartitionWrongNoSubpart      = mysql.NewStdErr("ddl", mysql.ErrPartitionWrongNoSubpart)
	ErrPartitionWrongValues         = mysql.NewStdErr("ddl", mysql.ErrPartitionWrongValues)
	ErrRowSinglePartitionField      = mysql.NewStdErr("ddl", mysql.ErrRowSinglePartitionField)
	ErrSubpartition                 = mysql.NewStdErr("ddl", mysql.ErrSubpartition)
	ErrTooManyValues                = mysql.NewStdErr("ddl", mysql.ErrTooManyValues)
	ErrUnknownCharacterSet          = mysql.NewStdErr("ddl", mysql.ErrUnknownCharacterSet)
	ErrCoalescePartitionNoPartition = mysql.NewStdErr("ddl", mysql.ErrCoalescePartitionNoPartition)
	ErrWrongUsage                   = mysql.NewStdErr("ddl", mysql.ErrWrongUsage)
)
View Source
var AnalyzeOptionString = map[AnalyzeOptionType]string{
	AnalyzeOptNumBuckets: "BUCKETS",
}

AnalyzeOptionString stores the string form of analyze options.

View Source
var ZeroBinaryLiteral = BinaryLiteral{}

ZeroBinaryLiteral is a BinaryLiteral literal with zero value.

Functions

func DefaultTypeForValue

func DefaultTypeForValue(value any, tp *types.FieldType, charset string, collate string)

DefaultTypeForValue returns the default FieldType for the value.

func IsConditionInformationItem

func IsConditionInformationItem(name string) bool

IsConditionInformationItem reports whether name is a valid GET DIAGNOSTICS condition information item.

func IsStatementInformationItem

func IsStatementInformationItem(name string) bool

IsStatementInformationItem reports whether name is a valid GET DIAGNOSTICS statement information item. MySQL keeps the statement and condition item sets disjoint and rejects mixing them with a syntax error.

func SetBinChsClnFlag

func SetBinChsClnFlag(ft *types.FieldType)

SetBinChsClnFlag sets charset, collation as 'binary' and adds binaryFlag to FieldType.

func StrLenOfInt64Fast

func StrLenOfInt64Fast(x int64) int

StrLenOfInt64Fast efficiently calculate the string character lengths of an int64 as input

func StrLenOfUint64Fast

func StrLenOfUint64Fast(x uint64) int

StrLenOfUint64Fast efficiently calculate the string character lengths of an uint64 as input

Types

type AggregateFuncExpr

type AggregateFuncExpr struct {

	// F is the function name.
	F string
	// Args is the function args.
	Args []ExprNode
	// Distinct is true, function hence only aggregate distinct values.
	// For example, column c1 values are "1", "2", "2",  "sum(c1)" is "5",
	// but "sum(distinct c1)" is "3".
	Distinct bool
	// Order is only used in GROUP_CONCAT
	Order *OrderByClause
	// contains filtered or unexported fields
}

AggregateFuncExpr represents aggregate function expression.

func (*AggregateFuncExpr) Accept

func (n *AggregateFuncExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AggregateFuncExpr) Restore

func (n *AggregateFuncExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlgorithmType

type AlgorithmType byte

AlgorithmType is the algorithm of the DDL operations. See https://dev.mysql.com/doc/refman/8.0/en/alter-table.html#alter-table-performance.

const (
	AlgorithmTypeDefault AlgorithmType = iota
	AlgorithmTypeCopy
	AlgorithmTypeInplace
	AlgorithmTypeInstant
)

DDL algorithms.

func (AlgorithmType) String

func (a AlgorithmType) String() string

type AlterDatabaseStmt

type AlterDatabaseStmt struct {
	Name                 CIStr
	AlterDefaultDatabase bool
	Options              []*DatabaseOption
	// contains filtered or unexported fields
}

AlterDatabaseStmt is a statement to change the structure of a database. See https://dev.mysql.com/doc/refman/5.7/en/alter-database.html

func (*AlterDatabaseStmt) Accept

func (n *AlterDatabaseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterDatabaseStmt) Restore

func (n *AlterDatabaseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterEventStmt

type AlterEventStmt struct {
	Definer    *auth.UserIdentity
	Name       *TableName
	Schedule   *EventSchedule // nil when unchanged
	Completion EventCompletion
	RenameTo   *TableName
	Status     EventStatus
	HasComment bool
	Comment    string
	Body       StmtNode // nil when unchanged
	// contains filtered or unexported fields
}

AlterEventStmt is a statement to change an event. See https://dev.mysql.com/doc/refman/8.4/en/alter-event.html

func (*AlterEventStmt) Accept

func (n *AlterEventStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterEventStmt) Restore

func (n *AlterEventStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterFunctionStmt

type AlterFunctionStmt struct {
	Name    *TableName
	Options []*RoutineOption
	// contains filtered or unexported fields
}

AlterFunctionStmt is a statement to change stored function characteristics. See https://dev.mysql.com/doc/refman/8.4/en/alter-function.html

func (*AlterFunctionStmt) Accept

func (n *AlterFunctionStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterFunctionStmt) Restore

func (n *AlterFunctionStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterInstanceStmt

type AlterInstanceStmt struct {
	ReloadTLS         bool
	NoRollbackOnError bool
	// TLSChannel is the optional FOR CHANNEL of RELOAD TLS.
	TLSChannel string
	// RotateMasterKey is "INNODB" or "BINLOG" for ROTATE ... MASTER KEY.
	RotateMasterKey string
	// RedoLog is set for {ENABLE | DISABLE} INNODB REDO_LOG.
	RedoLog       RedoLogAction
	ReloadKeyring bool
	// contains filtered or unexported fields
}

AlterInstanceStmt modifies instance. See https://dev.mysql.com/doc/refman/8.4/en/alter-instance.html

func (*AlterInstanceStmt) Accept

func (n *AlterInstanceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterInstanceStmt) Restore

func (n *AlterInstanceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterLibraryStmt

type AlterLibraryStmt struct {
	Library *TableName
	Comment string
	// contains filtered or unexported fields
}

AlterLibraryStmt is a statement to alter a library's comment (MySQL 9.x). See https://dev.mysql.com/doc/refman/9.4/en/alter-library.html

func (*AlterLibraryStmt) Accept

func (n *AlterLibraryStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterLibraryStmt) Restore

func (n *AlterLibraryStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterLogfileGroupStmt

type AlterLogfileGroupStmt struct {
	Name     CIStr
	UndoFile string
	Options  []*TablespaceOption
	// contains filtered or unexported fields
}

AlterLogfileGroupStmt is a statement to add an undofile to a logfile group. See https://dev.mysql.com/doc/refman/8.4/en/alter-logfile-group.html

func (*AlterLogfileGroupStmt) Accept

func (n *AlterLogfileGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterLogfileGroupStmt) Restore

func (n *AlterLogfileGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterOrderItem

type AlterOrderItem struct {
	Column *ColumnName
	Desc   bool
	// contains filtered or unexported fields
}

AlterOrderItem represents an item in order by at alter table stmt.

func (*AlterOrderItem) OriginTextPosition

func (n *AlterOrderItem) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*AlterOrderItem) OriginalText

func (n *AlterOrderItem) OriginalText() string

OriginalText implements Node interface.

func (*AlterOrderItem) Restore

func (n *AlterOrderItem) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*AlterOrderItem) SetNoBackslashEscapes

func (n *AlterOrderItem) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*AlterOrderItem) SetOriginTextPosition

func (n *AlterOrderItem) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*AlterOrderItem) SetText

func (n *AlterOrderItem) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*AlterOrderItem) Text

func (n *AlterOrderItem) Text() string

Text implements Node interface.

type AlterProcedureStmt

type AlterProcedureStmt struct {
	Name    *TableName
	Options []*RoutineOption
	// contains filtered or unexported fields
}

AlterProcedureStmt is a statement to change stored procedure characteristics. See https://dev.mysql.com/doc/refman/8.4/en/alter-procedure.html

func (*AlterProcedureStmt) Accept

func (n *AlterProcedureStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterProcedureStmt) Restore

func (n *AlterProcedureStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterResourceGroupStmt

type AlterResourceGroupStmt struct {
	Name           CIStr
	Vcpus          []VcpuRange
	ThreadPriority *int64
	Enable         *bool
	Force          bool
	// contains filtered or unexported fields
}

AlterResourceGroupStmt is an ALTER RESOURCE GROUP statement.

func (*AlterResourceGroupStmt) Accept

func (n *AlterResourceGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterResourceGroupStmt) Restore

func (n *AlterResourceGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterServerStmt

type AlterServerStmt struct {
	Name    CIStr
	Options []*ServerOption
	// contains filtered or unexported fields
}

AlterServerStmt is an ALTER SERVER statement.

func (*AlterServerStmt) Accept

func (n *AlterServerStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterServerStmt) Restore

func (n *AlterServerStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterTableSpec

type AlterTableSpec struct {
	NoWriteToBinlog bool
	OnAllPartitions bool

	Tp              AlterTableType
	Name            string
	IndexName       CIStr
	Constraint      *Constraint
	Options         []*TableOption
	OrderByList     []*AlterOrderItem
	NewTable        *TableName
	NewColumns      []*ColumnDef
	NewConstraints  []*Constraint
	OldColumnName   *ColumnName
	NewColumnName   *ColumnName
	Position        *ColumnPosition
	LockType        LockType
	Algorithm       AlgorithmType
	Comment         string
	FromKey         CIStr
	ToKey           CIStr
	Partition       *PartitionOptions
	PartitionNames  []CIStr
	PartDefinitions []*PartitionDefinition
	WithValidation  bool
	Num             uint64
	Visibility      IndexVisibility
	// contains filtered or unexported fields
}

AlterTableSpec represents alter table specification.

func (*AlterTableSpec) Accept

func (n *AlterTableSpec) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterTableSpec) OriginTextPosition

func (n *AlterTableSpec) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*AlterTableSpec) OriginalText

func (n *AlterTableSpec) OriginalText() string

OriginalText implements Node interface.

func (*AlterTableSpec) Restore

func (n *AlterTableSpec) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*AlterTableSpec) SetNoBackslashEscapes

func (n *AlterTableSpec) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*AlterTableSpec) SetOriginTextPosition

func (n *AlterTableSpec) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*AlterTableSpec) SetText

func (n *AlterTableSpec) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*AlterTableSpec) Text

func (n *AlterTableSpec) Text() string

Text implements Node interface.

type AlterTableStmt

type AlterTableStmt struct {
	Table *TableName
	Specs []*AlterTableSpec
	// contains filtered or unexported fields
}

AlterTableStmt is a statement to change the structure of a table. See https://dev.mysql.com/doc/refman/5.7/en/alter-table.html

func (*AlterTableStmt) Accept

func (n *AlterTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterTableStmt) Restore

func (n *AlterTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterTableType

type AlterTableType int

AlterTableType is the type for AlterTableSpec.

const (
	AlterTableOption AlterTableType = iota + 1
	AlterTableAddColumns
	AlterTableAddConstraint
	AlterTableDropColumn
	AlterTableDropPrimaryKey
	AlterTableDropIndex
	AlterTableDropForeignKey
	AlterTableModifyColumn
	AlterTableChangeColumn
	AlterTableRenameColumn
	AlterTableRenameTable
	AlterTableAlterColumn
	AlterTableLock
	AlterTableAlgorithm
	AlterTableRenameIndex
	AlterTableForce
	AlterTableAddPartitions
	AlterTableCoalescePartitions
	AlterTableDropPartition
	AlterTableTruncatePartition
	AlterTablePartition
	AlterTableEnableKeys
	AlterTableDisableKeys
	AlterTableRemovePartitioning
	AlterTableWithValidation
	AlterTableWithoutValidation
	AlterTableSecondaryLoad
	AlterTableSecondaryUnload
	AlterTableRebuildPartition
	AlterTableReorganizePartition
	AlterTableCheckPartitions
	AlterTableAnalyzePartitions
	AlterTableExchangePartition
	AlterTableOptimizePartition
	AlterTableRepairPartition
	AlterTableImportPartitionTablespace
	AlterTableDiscardPartitionTablespace
	AlterTableAlterCheck
	AlterTableDropCheck
	// AlterTableDropConstraint is DROP CONSTRAINT, which MySQL accepts for a
	// CHECK, FOREIGN KEY or UNIQUE constraint of that name. It is kept
	// distinct from AlterTableDropCheck (which only drops a check constraint)
	// so that restoring the statement reproduces the keyword the user wrote:
	// rendering DROP CONSTRAINT as DROP CHECK turns a statement MySQL accepts
	// into one it rejects with error 3821.
	AlterTableDropConstraint
	AlterTableImportTablespace
	AlterTableDiscardTablespace
	AlterTableIndexInvisible
	AlterTableAlterColumnVisibility
	// TODO: Add more actions
	AlterTableOrderByColumns
)

AlterTable types.

type AlterTablespaceActionType

type AlterTablespaceActionType int

AlterTablespaceActionType is the action of an ALTER [UNDO] TABLESPACE.

const (
	AlterTablespaceOptionsOnly AlterTablespaceActionType = iota
	AlterTablespaceAddDataFile
	AlterTablespaceDropDataFile
	AlterTablespaceRenameTo
	AlterTablespaceSetActive
	AlterTablespaceSetInactive
)

Alter tablespace actions.

type AlterTablespaceStmt

type AlterTablespaceStmt struct {
	Undo     bool
	Name     CIStr
	Action   AlterTablespaceActionType
	DataFile string
	NewName  CIStr
	Options  []*TablespaceOption
	// contains filtered or unexported fields
}

AlterTablespaceStmt is a statement to modify a tablespace. See https://dev.mysql.com/doc/refman/8.4/en/alter-tablespace.html

func (*AlterTablespaceStmt) Accept

func (n *AlterTablespaceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterTablespaceStmt) Restore

func (n *AlterTablespaceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterUserDefaultRoleStmt

type AlterUserDefaultRoleStmt struct {
	IfExists   bool
	User       *auth.UserIdentity
	SetRoleOpt SetRoleStmtType
	RoleList   []*auth.RoleIdentity
	// contains filtered or unexported fields
}

AlterUserDefaultRoleStmt is ALTER USER [IF EXISTS] user DEFAULT ROLE {NONE | ALL | role [, role]...}.

func (*AlterUserDefaultRoleStmt) Accept

func (n *AlterUserDefaultRoleStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterUserDefaultRoleStmt) Restore

Restore implements Node interface.

type AlterUserFactorStmt

type AlterUserFactorStmt struct {
	IfExists             bool
	User                 *auth.UserIdentity
	Op                   FactorOp
	Factor               uint64
	AuthOpt              *AuthOption // ADD / MODIFY
	HasChallengeResponse bool
	ChallengeResponse    string // FINISH REGISTRATION
	// contains filtered or unexported fields
}

AlterUserFactorStmt covers the ALTER USER multi-factor authentication forms (MySQL 8.0.27+):

ALTER USER [IF EXISTS] user ADD | MODIFY factor FACTOR identification
ALTER USER [IF EXISTS] user DROP factor FACTOR
ALTER USER [IF EXISTS] user factor FACTOR INITIATE REGISTRATION
ALTER USER [IF EXISTS] user factor FACTOR FINISH REGISTRATION
    SET CHALLENGE_RESPONSE AS 'auth_string'
ALTER USER [IF EXISTS] user factor FACTOR UNREGISTER

func (*AlterUserFactorStmt) Accept

func (n *AlterUserFactorStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterUserFactorStmt) Restore

func (n *AlterUserFactorStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterUserStmt

type AlterUserStmt struct {
	IfExists    bool
	CurrentAuth *AuthOption
	// CurrentDualPasswordOption carries the dual-password clause attached to
	// the `ALTER USER USER() ...` (current-user) form. The named-user form
	// stores its dual-password clause on the per-UserSpec DualPasswordOption.
	CurrentDualPasswordOption DualPasswordOptionType
	Specs                     []*UserSpec
	AuthTokenOrTLSOptions     []*AuthTokenOrTLSOption
	ResourceOptions           []*ResourceOption
	PasswordOrLockOptions     []*PasswordOrLockOption
	CommentOrAttributeOption  *CommentOrAttributeOption
	ResourceGroupNameOption   *ResourceGroupNameOption
	// contains filtered or unexported fields
}

AlterUserStmt modifies user account. See https://dev.mysql.com/doc/refman/8.0/en/alter-user.html

func (*AlterUserStmt) Accept

func (n *AlterUserStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterUserStmt) Restore

func (n *AlterUserStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AlterViewStmt

type AlterViewStmt struct {
	ViewName    *TableName
	Cols        []CIStr
	Select      StmtNode
	Algorithm   ViewAlgorithm
	Definer     *auth.UserIdentity
	Security    ViewSecurity
	CheckOption ViewCheckOption
	// contains filtered or unexported fields
}

AlterViewStmt is a statement to alter a View. See https://dev.mysql.com/doc/refman/8.4/en/alter-view.html

func (*AlterViewStmt) Accept

func (n *AlterViewStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AlterViewStmt) Restore

func (n *AlterViewStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AnalyzeOpt

type AnalyzeOpt struct {
	Type  AnalyzeOptionType
	Value *ValueExpr
}

AnalyzeOpt stores the analyze option type and value.

type AnalyzeOptionType

type AnalyzeOptionType int

AnalyzeOptionType is the type for analyze options.

const (
	AnalyzeOptNumBuckets AnalyzeOptionType = iota
)

Analyze option types.

type AnalyzeTableStmt

type AnalyzeTableStmt struct {
	TableNames     []*TableName
	PartitionNames []CIStr
	AnalyzeOpts    []AnalyzeOpt

	NoWriteToBinLog bool
	// HistogramOperation is set in "ANALYZE TABLE ... UPDATE/DROP HISTOGRAM ..." statement.
	HistogramOperation HistogramOperationType
	// ColumnNames indicate the columns whose histograms are updated or dropped.
	ColumnNames []CIStr
	// HistogramUpdate is the MANUAL/AUTO UPDATE suffix of UPDATE HISTOGRAM (MySQL 8.4+).
	HistogramUpdate HistogramUpdateType
	// UsingData is set for UPDATE HISTOGRAM ... USING DATA 'json'; HistogramData
	// holds the JSON payload.
	UsingData     bool
	HistogramData string
	// contains filtered or unexported fields
}

AnalyzeTableStmt is the MySQL ANALYZE TABLE statement, including the histogram forms: ANALYZE TABLE t UPDATE HISTOGRAM ON c [WITH n BUCKETS] and ANALYZE TABLE t DROP HISTOGRAM ON c.

func (*AnalyzeTableStmt) Accept

func (n *AnalyzeTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*AnalyzeTableStmt) Restore

func (n *AnalyzeTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type Assignment

type Assignment struct {

	// Column is the column name to be assigned.
	Column *ColumnName
	// Expr is the expression assigning to ColName.
	Expr ExprNode
	// contains filtered or unexported fields
}

Assignment is the expression for assignment, like a = 1.

func (*Assignment) Accept

func (n *Assignment) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*Assignment) OriginTextPosition

func (n *Assignment) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*Assignment) OriginalText

func (n *Assignment) OriginalText() string

OriginalText implements Node interface.

func (*Assignment) Restore

func (n *Assignment) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*Assignment) SetNoBackslashEscapes

func (n *Assignment) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*Assignment) SetOriginTextPosition

func (n *Assignment) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*Assignment) SetText

func (n *Assignment) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*Assignment) Text

func (n *Assignment) Text() string

Text implements Node interface.

type AuthOption

type AuthOption struct {
	// ByAuthString set as true, if AuthString is used for authorization. Otherwise, authorization is done by HashString.
	ByAuthString bool
	AuthString   string
	ByHashString bool
	HashString   string
	AuthPlugin   string
	// ByRandomPassword is the IDENTIFIED BY RANDOM PASSWORD form (MySQL 8.0.18+).
	ByRandomPassword bool
	// HasReplace / ReplaceString carry REPLACE 'current password'
	// (MySQL 8.0.14+ password verification). HasReplace distinguishes an
	// absent clause from REPLACE ”.
	HasReplace    bool
	ReplaceString string
	// InitialAuth is the IDENTIFIED WITH plugin INITIAL AUTHENTICATION ...
	// form used for passwordless authentication (MySQL 8.0.27+).
	InitialAuth *AuthOption
}

AuthOption is used for parsing create use statement.

func (*AuthOption) Restore

func (n *AuthOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type AuthTokenOrTLSOption

type AuthTokenOrTLSOption struct {
	Type  AuthTokenOrTLSOptionType
	Value string
}

func (*AuthTokenOrTLSOption) Restore

func (t *AuthTokenOrTLSOption) Restore(ctx *format.RestoreCtx) error

type AuthTokenOrTLSOptionType

type AuthTokenOrTLSOptionType int
const (
	TlsNone AuthTokenOrTLSOptionType = iota
	Ssl
	X509
	Cipher
	Issuer
	Subject
	SAN
	TokenIssuer
)

func (AuthTokenOrTLSOptionType) String

func (t AuthTokenOrTLSOptionType) String() string

type BeginEndStmt

type BeginEndStmt struct {
	Label       CIStr
	HasEndLabel bool
	Stmts       []StmtNode
	// contains filtered or unexported fields
}

BeginEndStmt is a BEGIN ... END compound statement.

func (*BeginEndStmt) Accept

func (n *BeginEndStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*BeginEndStmt) Restore

func (n *BeginEndStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type BeginStmt

type BeginStmt struct {
	ReadOnly bool
	// contains filtered or unexported fields
}

BeginStmt is a statement to start a new transaction. See https://dev.mysql.com/doc/refman/5.7/en/commit.html

func (*BeginStmt) Accept

func (n *BeginStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*BeginStmt) Restore

func (n *BeginStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type BetweenExpr

type BetweenExpr struct {

	// Expr is the expression to be checked.
	Expr ExprNode
	// Left is the expression for minimal value in the range.
	Left ExprNode
	// Right is the expression for maximum value in the range.
	Right ExprNode
	// Not is true, the expression is "not between and".
	Not bool
	// contains filtered or unexported fields
}

BetweenExpr is for "between and" or "not between and" expression.

func (*BetweenExpr) Accept

func (n *BetweenExpr) Accept(v Visitor) (Node, bool)

Accept implements Node interface.

func (*BetweenExpr) GetType

func (en *BetweenExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*BetweenExpr) Restore

func (n *BetweenExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*BetweenExpr) SetType

func (en *BetweenExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type BinaryLiteral

type BinaryLiteral []byte

BinaryLiteral is the internal type for storing bit / hex literal type.

func ParseBitStr

func ParseBitStr(s string) (BinaryLiteral, error)

ParseBitStr parses bit string. The string format can be b'val', B'val' or 0bval, val must be 0 or 1. See https://dev.mysql.com/doc/refman/5.7/en/bit-value-literals.html

func ParseHexStr

func ParseHexStr(s string) (BinaryLiteral, error)

ParseHexStr parses hexadecimal string literal. See https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html

func (BinaryLiteral) String

func (b BinaryLiteral) String() string

String implements fmt.Stringer interface.

func (BinaryLiteral) ToBitLiteralString

func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string

ToBitLiteralString returns the bit literal representation for the literal.

func (BinaryLiteral) ToString

func (b BinaryLiteral) ToString() string

ToString returns the string representation for the literal.

type BinaryOperationExpr

type BinaryOperationExpr struct {

	// Op is the operator code for BinaryOperation.
	Op opcode.Op
	// L is the left expression in BinaryOperation.
	L ExprNode
	// R is the right expression in BinaryOperation.
	R ExprNode
	// contains filtered or unexported fields
}

BinaryOperationExpr is for binary operation like `1 + 1`, `1 - 1`, etc.

func (*BinaryOperationExpr) Accept

func (n *BinaryOperationExpr) Accept(v Visitor) (Node, bool)

Accept implements Node interface.

func (*BinaryOperationExpr) GetType

func (en *BinaryOperationExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*BinaryOperationExpr) Restore

func (n *BinaryOperationExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*BinaryOperationExpr) SetType

func (en *BinaryOperationExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type BinlogStmt

type BinlogStmt struct {
	Str string
	// contains filtered or unexported fields
}

BinlogStmt is an internal-use statement. We just parse and ignore it. See http://dev.mysql.com/doc/refman/5.7/en/binlog.html

func (*BinlogStmt) Accept

func (n *BinlogStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*BinlogStmt) Restore

func (n *BinlogStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type BitLiteral

type BitLiteral BinaryLiteral

BitLiteral is the bit literal type.

func NewBitLiteral

func NewBitLiteral(s string) (BitLiteral, error)

NewBitLiteral parses bit string as BitLiteral type.

func (BitLiteral) ToString

func (b BitLiteral) ToString() string

ToString returns the string representation for the literal.

type BoundType

type BoundType int

FrameType is the type of window function frame bound.

type ByItem

type ByItem struct {
	Expr      ExprNode
	Desc      bool
	NullOrder bool
	// contains filtered or unexported fields
}

ByItem represents an item in order by or group by.

func (*ByItem) Accept

func (n *ByItem) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ByItem) OriginTextPosition

func (n *ByItem) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ByItem) OriginalText

func (n *ByItem) OriginalText() string

OriginalText implements Node interface.

func (*ByItem) Restore

func (n *ByItem) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ByItem) SetNoBackslashEscapes

func (n *ByItem) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ByItem) SetOriginTextPosition

func (n *ByItem) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ByItem) SetText

func (n *ByItem) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ByItem) Text

func (n *ByItem) Text() string

Text implements Node interface.

type CIStr

type CIStr struct {
	O string `json:"O"` // Original string.
	L string `json:"L"` // Lower case string.
}

CIStr is case insensitive string.

func NewCIStr

func NewCIStr(s string) (cs CIStr)

NewCIStr creates a new CIStr.

func (*CIStr) MemoryUsage

func (cis *CIStr) MemoryUsage() (sum int64)

MemoryUsage return the memory usage of CIStr

func (CIStr) String

func (cis CIStr) String() string

String implements fmt.Stringer interface.

func (*CIStr) UnmarshalJSON

func (cis *CIStr) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the user defined unmarshal method. CIStr can also be unmarshaled from a plain JSON string for backward compatibility with older serialized forms.

type CacheIndexStmt

type CacheIndexStmt struct {
	TableIndexes []*CacheTableIndex
	CacheName    CIStr
	// contains filtered or unexported fields
}

CacheIndexStmt is a CACHE INDEX ... IN statement (MyISAM key caches). See https://dev.mysql.com/doc/refman/8.0/en/cache-index.html

func (*CacheIndexStmt) Accept

func (n *CacheIndexStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CacheIndexStmt) Restore

func (n *CacheIndexStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CacheTableIndex

type CacheTableIndex struct {
	Table *TableName
	// AllPartitions is PARTITION (ALL); PartitionNames is the explicit list.
	AllPartitions  bool
	PartitionNames []CIStr
	IndexNames     []CIStr
	// IgnoreLeaves is only meaningful under LOAD INDEX INTO CACHE.
	IgnoreLeaves bool
}

CacheTableIndex is one table entry of a CACHE INDEX or LOAD INDEX INTO CACHE statement.

type CallStmt

type CallStmt struct {
	Procedure *FuncCallExpr
	// contains filtered or unexported fields
}

CallStmt represents a call procedure query node. See https://dev.mysql.com/doc/refman/5.7/en/call.html

func (*CallStmt) Accept

func (n *CallStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CallStmt) Restore

func (n *CallStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CaseExpr

type CaseExpr struct {

	// Value is the compare value expression.
	Value ExprNode
	// WhenClauses is the condition check expression.
	WhenClauses []*WhenClause
	// ElseClause is the else result expression.
	ElseClause ExprNode
	// contains filtered or unexported fields
}

CaseExpr is the case expression.

func (*CaseExpr) Accept

func (n *CaseExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CaseExpr) GetType

func (en *CaseExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*CaseExpr) Restore

func (n *CaseExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*CaseExpr) SetType

func (en *CaseExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type CastFunctionType

type CastFunctionType int

CastFunctionType is the type for cast function.

const (
	CastFunction CastFunctionType = iota + 1
	CastConvertFunction
	CastBinaryOperator
)

CastFunction types

type ChangeReplicationFilterStmt

type ChangeReplicationFilterStmt struct {
	Filters    []*ReplicationOption
	Channel    string
	HasChannel bool
	// contains filtered or unexported fields
}

ChangeReplicationFilterStmt is a CHANGE REPLICATION FILTER statement. See https://dev.mysql.com/doc/refman/8.0/en/change-replication-filter.html

func (*ChangeReplicationFilterStmt) Accept

func (n *ChangeReplicationFilterStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ChangeReplicationFilterStmt) Restore

Restore implements Node interface.

type ChangeReplicationSourceStmt

type ChangeReplicationSourceStmt struct {
	Options    []*ReplicationOption
	Channel    string
	HasChannel bool
	// contains filtered or unexported fields
}

ChangeReplicationSourceStmt is a CHANGE REPLICATION SOURCE TO statement. The deprecated CHANGE MASTER TO spelling parses to the same node, keeping its MASTER_* option names. See https://dev.mysql.com/doc/refman/8.0/en/change-replication-source-to.html

func (*ChangeReplicationSourceStmt) Accept

func (n *ChangeReplicationSourceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ChangeReplicationSourceStmt) Restore

Restore implements Node interface.

type CheckTableCheckOption

type CheckTableCheckOption int

CheckTableCheckOption is one option of a CHECK TABLE statement.

const (
	CheckOptionForUpgrade CheckTableCheckOption = iota
	CheckOptionQuick
	CheckOptionFast
	CheckOptionMedium
	CheckOptionExtended
	CheckOptionChanged
)

CheckTableCheckOption values, in MySQL's own listing order.

func (CheckTableCheckOption) String

func (o CheckTableCheckOption) String() string

String implements fmt.Stringer interface.

type CheckTableStmt

type CheckTableStmt struct {
	Tables  []*TableName
	Options []CheckTableCheckOption
	// contains filtered or unexported fields
}

CheckTableStmt is a CHECK TABLE statement. See https://dev.mysql.com/doc/refman/8.0/en/check-table.html

func (*CheckTableStmt) Accept

func (n *CheckTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CheckTableStmt) Restore

func (n *CheckTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ChecksumTableStmt

type ChecksumTableStmt struct {
	Tables []*TableName
	Type   ChecksumType
	// contains filtered or unexported fields
}

ChecksumTableStmt is a CHECKSUM TABLE statement. See https://dev.mysql.com/doc/refman/8.0/en/checksum-table.html

func (*ChecksumTableStmt) Accept

func (n *ChecksumTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ChecksumTableStmt) Restore

func (n *ChecksumTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ChecksumType

type ChecksumType int

ChecksumType is the QUICK/EXTENDED modifier of a CHECKSUM TABLE statement.

const (
	ChecksumTypeDefault ChecksumType = iota
	ChecksumTypeQuick
	ChecksumTypeExtended
)

ChecksumType values.

type CloneStmt

type CloneStmt struct {

	// Local is CLONE LOCAL DATA DIRECTORY; otherwise CLONE INSTANCE.
	Local bool
	// DataDirectory is required for LOCAL, optional for INSTANCE.
	HasDataDirectory bool
	DataDirectory    string

	User     *auth.UserIdentity
	Port     uint64
	Password string
	// RequireSSL is nil when no REQUIRE clause was given.
	RequireSSL *bool
	// contains filtered or unexported fields
}

CloneStmt is a CLONE LOCAL or CLONE INSTANCE statement. See https://dev.mysql.com/doc/refman/8.0/en/clone.html

func (*CloneStmt) Accept

func (n *CloneStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CloneStmt) Restore

func (n *CloneStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CloseCursorStmt

type CloseCursorStmt struct {
	Name CIStr
	// contains filtered or unexported fields
}

CloseCursorStmt is a CLOSE cursor statement in a compound body.

func (*CloseCursorStmt) Accept

func (n *CloseCursorStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CloseCursorStmt) Restore

func (n *CloseCursorStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ColumnDef

type ColumnDef struct {
	Name    *ColumnName
	Tp      *types.FieldType
	Options []*ColumnOption
	// contains filtered or unexported fields
}

ColumnDef is used for parsing column definition from SQL.

func (*ColumnDef) Accept

func (n *ColumnDef) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ColumnDef) OriginTextPosition

func (n *ColumnDef) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ColumnDef) OriginalText

func (n *ColumnDef) OriginalText() string

OriginalText implements Node interface.

func (*ColumnDef) Restore

func (n *ColumnDef) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ColumnDef) SetNoBackslashEscapes

func (n *ColumnDef) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ColumnDef) SetOriginTextPosition

func (n *ColumnDef) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ColumnDef) SetText

func (n *ColumnDef) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ColumnDef) Text

func (n *ColumnDef) Text() string

Text implements Node interface.

func (*ColumnDef) Validate

func (n *ColumnDef) Validate() error

Validate checks if a column definition is legal. For example, generated column definitions that contain such column options as `ON UPDATE`, `AUTO_INCREMENT`, `DEFAULT` are illegal.

type ColumnName

type ColumnName struct {
	Schema CIStr
	Table  CIStr
	Name   CIStr
	// contains filtered or unexported fields
}

ColumnName represents column name.

func (*ColumnName) Accept

func (n *ColumnName) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ColumnName) Match

func (n *ColumnName) Match(b *ColumnName) bool

Match means that if a match b, e.g. t.a can match test.t.a but test.t.a can't match t.a. Because column a want column from database test exactly.

func (*ColumnName) OrigColName

func (n *ColumnName) OrigColName() (ret string)

OrigColName returns the full original column name.

func (*ColumnName) OriginTextPosition

func (n *ColumnName) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ColumnName) OriginalText

func (n *ColumnName) OriginalText() string

OriginalText implements Node interface.

func (*ColumnName) Restore

func (n *ColumnName) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ColumnName) SetNoBackslashEscapes

func (n *ColumnName) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ColumnName) SetOriginTextPosition

func (n *ColumnName) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ColumnName) SetText

func (n *ColumnName) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ColumnName) String

func (n *ColumnName) String() string

String implements Stringer interface.

func (*ColumnName) Text

func (n *ColumnName) Text() string

Text implements Node interface.

type ColumnNameExpr

type ColumnNameExpr struct {

	// Name is the referenced column name.
	Name *ColumnName
	// contains filtered or unexported fields
}

ColumnNameExpr represents a column name expression.

func (*ColumnNameExpr) Accept

func (n *ColumnNameExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ColumnNameExpr) GetType

func (en *ColumnNameExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ColumnNameExpr) Restore

func (n *ColumnNameExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ColumnNameExpr) SetType

func (en *ColumnNameExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type ColumnNameOrUserVar

type ColumnNameOrUserVar struct {
	ColumnName *ColumnName
	UserVar    *VariableExpr
	// contains filtered or unexported fields
}

func (*ColumnNameOrUserVar) Accept

func (n *ColumnNameOrUserVar) Accept(v Visitor) (node Node, ok bool)

func (*ColumnNameOrUserVar) OriginTextPosition

func (n *ColumnNameOrUserVar) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ColumnNameOrUserVar) OriginalText

func (n *ColumnNameOrUserVar) OriginalText() string

OriginalText implements Node interface.

func (*ColumnNameOrUserVar) Restore

func (n *ColumnNameOrUserVar) Restore(ctx *format.RestoreCtx) error

func (*ColumnNameOrUserVar) SetNoBackslashEscapes

func (n *ColumnNameOrUserVar) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ColumnNameOrUserVar) SetOriginTextPosition

func (n *ColumnNameOrUserVar) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ColumnNameOrUserVar) SetText

func (n *ColumnNameOrUserVar) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ColumnNameOrUserVar) Text

func (n *ColumnNameOrUserVar) Text() string

Text implements Node interface.

type ColumnOption

type ColumnOption struct {
	Tp ColumnOptionType
	// Expr is used for ColumnOptionDefaultValue/ColumnOptionOnUpdateColumnOptionGenerated.
	// For ColumnOptionDefaultValue or ColumnOptionOnUpdate, it's the target value.
	// For ColumnOptionGenerated, it's the target expression.
	Expr ExprNode
	// Stored is only for ColumnOptionGenerated, default is false.
	Stored bool
	// Refer is used for foreign key.
	Refer    *ReferenceDef
	StrValue string
	// Enforced is only for Check, default is true.
	Enforced bool
	// Name is only used for Check Constraint name.
	ConstraintName      string
	SecondaryEngineAttr string
	Srid                uint32
	// contains filtered or unexported fields
}

ColumnOption is used for parsing column constraint info from SQL.

func (*ColumnOption) Accept

func (n *ColumnOption) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ColumnOption) OriginTextPosition

func (n *ColumnOption) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ColumnOption) OriginalText

func (n *ColumnOption) OriginalText() string

OriginalText implements Node interface.

func (*ColumnOption) Restore

func (n *ColumnOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ColumnOption) SetNoBackslashEscapes

func (n *ColumnOption) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ColumnOption) SetOriginTextPosition

func (n *ColumnOption) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ColumnOption) SetText

func (n *ColumnOption) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ColumnOption) Text

func (n *ColumnOption) Text() string

Text implements Node interface.

type ColumnOptionList

type ColumnOptionList struct {
	HasCollateOption bool
	Options          []*ColumnOption
}

ColumnOptionList stores column options.

type ColumnOptionType

type ColumnOptionType int

ColumnOptionType is the type for ColumnOption.

const (
	ColumnOptionNoOption ColumnOptionType = iota
	ColumnOptionPrimaryKey
	ColumnOptionNotNull
	ColumnOptionAutoIncrement
	ColumnOptionDefaultValue
	ColumnOptionUniqKey
	ColumnOptionNull
	ColumnOptionOnUpdate // For Timestamp and Datetime only.
	ColumnOptionComment
	ColumnOptionGenerated
	ColumnOptionReference
	ColumnOptionCollate
	ColumnOptionCheck
	ColumnOptionColumnFormat
	ColumnOptionStorage
	ColumnOptionSecondaryEngineAttribute
	ColumnOptionSrid
	ColumnOptionVisibility
	ColumnOptionEngineAttribute
	ColumnOptionNotSecondary
)

ColumnOption types.

type ColumnPosition

type ColumnPosition struct {

	// Tp is either ColumnPositionNone, ColumnPositionFirst or ColumnPositionAfter.
	Tp ColumnPositionType
	// RelativeColumn is the column the newly added column after if type is ColumnPositionAfter
	RelativeColumn *ColumnName
	// contains filtered or unexported fields
}

ColumnPosition represent the position of the newly added column

func (*ColumnPosition) Accept

func (n *ColumnPosition) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ColumnPosition) OriginTextPosition

func (n *ColumnPosition) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ColumnPosition) OriginalText

func (n *ColumnPosition) OriginalText() string

OriginalText implements Node interface.

func (*ColumnPosition) Restore

func (n *ColumnPosition) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ColumnPosition) SetNoBackslashEscapes

func (n *ColumnPosition) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ColumnPosition) SetOriginTextPosition

func (n *ColumnPosition) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ColumnPosition) SetText

func (n *ColumnPosition) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ColumnPosition) Text

func (n *ColumnPosition) Text() string

Text implements Node interface.

type ColumnPositionType

type ColumnPositionType int

ColumnPositionType is the type for ColumnPosition.

const (
	ColumnPositionNone ColumnPositionType = iota
	ColumnPositionFirst
	ColumnPositionAfter
)

ColumnPosition Types

type CommentOrAttributeOption

type CommentOrAttributeOption struct {
	Type  int
	Value string
}

func (*CommentOrAttributeOption) Restore

type CommitStmt

type CommitStmt struct {

	// CompletionType overwrites system variable `completion_type` within transaction
	CompletionType CompletionType
	// contains filtered or unexported fields
}

CommitStmt is a statement to commit the current transaction. See https://dev.mysql.com/doc/refman/5.7/en/commit.html

func (*CommitStmt) Accept

func (n *CommitStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CommitStmt) Restore

func (n *CommitStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CommonTableExpression

type CommonTableExpression struct {
	Name        CIStr
	Query       *SubqueryExpr
	ColNameList []CIStr
	IsRecursive bool

	// Record how many consumers the current cte has
	ConsumerCount int
	// contains filtered or unexported fields
}

func (*CommonTableExpression) Accept

func (c *CommonTableExpression) Accept(v Visitor) (Node, bool)

Accept implements Node interface

func (*CommonTableExpression) OriginTextPosition

func (n *CommonTableExpression) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*CommonTableExpression) OriginalText

func (n *CommonTableExpression) OriginalText() string

OriginalText implements Node interface.

func (*CommonTableExpression) Restore

func (c *CommonTableExpression) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface

func (*CommonTableExpression) SetNoBackslashEscapes

func (n *CommonTableExpression) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*CommonTableExpression) SetOriginTextPosition

func (n *CommonTableExpression) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*CommonTableExpression) SetText

func (n *CommonTableExpression) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*CommonTableExpression) Text

func (n *CommonTableExpression) Text() string

Text implements Node interface.

type CompareSubqueryExpr

type CompareSubqueryExpr struct {

	// L is the left expression
	L ExprNode
	// Op is the comparison opcode.
	Op opcode.Op
	// R is the subquery for right expression, may be rewritten to other type of expression.
	R ExprNode
	// All is true, we should compare all records in subquery.
	All bool
	// contains filtered or unexported fields
}

CompareSubqueryExpr is the expression for "expr cmp (select ...)". See https://dev.mysql.com/doc/refman/5.7/en/comparisons-using-subqueries.html See https://dev.mysql.com/doc/refman/5.7/en/any-in-some-subqueries.html See https://dev.mysql.com/doc/refman/5.7/en/all-subqueries.html

func (*CompareSubqueryExpr) Accept

func (n *CompareSubqueryExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CompareSubqueryExpr) GetType

func (en *CompareSubqueryExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*CompareSubqueryExpr) Restore

func (n *CompareSubqueryExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*CompareSubqueryExpr) SetType

func (en *CompareSubqueryExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type CompletionType

type CompletionType int8

CompletionType defines completion_type used in COMMIT and ROLLBACK statements

const (
	// CompletionTypeDefault refers to NO_CHAIN
	CompletionTypeDefault CompletionType = iota
	CompletionTypeChain
	CompletionTypeRelease
)

func (CompletionType) Restore

func (n CompletionType) Restore(ctx *format.RestoreCtx) error

type Constraint

type Constraint struct {
	Tp   ConstraintType
	Name string

	Keys []*IndexPartSpecification // Used for PRIMARY KEY, UNIQUE, ......

	Refer *ReferenceDef // Used for foreign key.

	Option *IndexOption // Index Options

	Expr ExprNode // Used for Check

	Enforced bool // Used for Check

	InColumn bool // Used for Check

	InColumnName string // Used for Check
	IsEmptyIndex bool   // Used for Check
	// contains filtered or unexported fields
}

Constraint is constraint for table definition.

func (*Constraint) Accept

func (n *Constraint) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*Constraint) OriginTextPosition

func (n *Constraint) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*Constraint) OriginalText

func (n *Constraint) OriginalText() string

OriginalText implements Node interface.

func (*Constraint) Restore

func (n *Constraint) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*Constraint) SetNoBackslashEscapes

func (n *Constraint) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*Constraint) SetOriginTextPosition

func (n *Constraint) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*Constraint) SetText

func (n *Constraint) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*Constraint) Text

func (n *Constraint) Text() string

Text implements Node interface.

type ConstraintType

type ConstraintType int

ConstraintType is the type for Constraint.

const (
	ConstraintNoConstraint ConstraintType = iota
	ConstraintPrimaryKey
	ConstraintKey
	ConstraintIndex
	ConstraintUniq
	ConstraintUniqKey
	ConstraintUniqIndex
	ConstraintForeignKey
	// ConstraintFulltext is only used in AST.
	// It will be rewritten into ConstraintIndex after preprocessor phase.
	ConstraintFulltext
	ConstraintCheck
	ConstraintSpatial
)

ConstraintTypes

type CreateDatabaseStmt

type CreateDatabaseStmt struct {
	IfNotExists bool
	Name        CIStr
	Options     []*DatabaseOption
	// contains filtered or unexported fields
}

CreateDatabaseStmt is a statement to create a database. See https://dev.mysql.com/doc/refman/5.7/en/create-database.html

func (*CreateDatabaseStmt) Accept

func (n *CreateDatabaseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateDatabaseStmt) Restore

func (n *CreateDatabaseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateEventStmt

type CreateEventStmt struct {
	IfNotExists bool
	Definer     *auth.UserIdentity
	Name        *TableName
	Schedule    *EventSchedule
	Completion  EventCompletion
	Status      EventStatus
	HasComment  bool
	Comment     string
	Body        StmtNode
	// contains filtered or unexported fields
}

CreateEventStmt is a statement to create an event. See https://dev.mysql.com/doc/refman/8.4/en/create-event.html

func (*CreateEventStmt) Accept

func (n *CreateEventStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateEventStmt) Restore

func (n *CreateEventStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateFunctionStmt

type CreateFunctionStmt struct {
	IfNotExists bool
	Definer     *auth.UserIdentity
	Name        *TableName
	Params      []*RoutineParam
	ReturnType  *types.FieldType
	Options     []*RoutineOption
	Body        StmtNode
	BodyStr     string
	HasBodyStr  bool
	// contains filtered or unexported fields
}

CreateFunctionStmt is a statement to create a stored function. See https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html

func (*CreateFunctionStmt) Accept

func (n *CreateFunctionStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateFunctionStmt) Restore

func (n *CreateFunctionStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateIndexStmt

type CreateIndexStmt struct {
	IndexName               string
	Table                   *TableName
	IndexPartSpecifications []*IndexPartSpecification
	IndexOption             *IndexOption
	KeyType                 IndexKeyType
	LockAlg                 *IndexLockAndAlgorithm
	// contains filtered or unexported fields
}

CreateIndexStmt is a statement to create an index. See https://dev.mysql.com/doc/refman/5.7/en/create-index.html

func (*CreateIndexStmt) Accept

func (n *CreateIndexStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateIndexStmt) Restore

func (n *CreateIndexStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateJSONDualityViewStmt

type CreateJSONDualityViewStmt struct {
	OrReplace   bool
	Algorithm   ViewAlgorithm
	Definer     *auth.UserIdentity
	Security    ViewSecurity
	Relational  bool
	IfNotExists bool
	ViewName    *TableName
	Select      StmtNode
	// contains filtered or unexported fields
}

CreateJSONDualityViewStmt is a statement to create a JSON relational duality view. See https://dev.mysql.com/doc/refman/9.4/en/create-json-duality-view.html

func (*CreateJSONDualityViewStmt) Accept

func (n *CreateJSONDualityViewStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateJSONDualityViewStmt) Restore

Restore implements Node interface.

type CreateLibraryStmt

type CreateLibraryStmt struct {
	IfNotExists bool
	Library     *TableName
	HasComment  bool
	Comment     string
	Language    string
	Body        string
	// contains filtered or unexported fields
}

CreateLibraryStmt is a statement to create a library (MySQL 9.x). See https://dev.mysql.com/doc/refman/9.4/en/create-library.html

func (*CreateLibraryStmt) Accept

func (n *CreateLibraryStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateLibraryStmt) Restore

func (n *CreateLibraryStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateLoadableFunctionStmt

type CreateLoadableFunctionStmt struct {
	IfNotExists bool
	Aggregate   bool
	Name        *TableName
	ReturnType  string // STRING | INTEGER | REAL | DECIMAL
	Soname      string
	// contains filtered or unexported fields
}

CreateLoadableFunctionStmt is a statement to register a loadable (UDF) function. See https://dev.mysql.com/doc/refman/8.4/en/create-function-loadable.html

func (*CreateLoadableFunctionStmt) Accept

func (n *CreateLoadableFunctionStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateLoadableFunctionStmt) Restore

Restore implements Node interface.

type CreateLogfileGroupStmt

type CreateLogfileGroupStmt struct {
	Name     CIStr
	UndoFile string
	Options  []*TablespaceOption
	// contains filtered or unexported fields
}

CreateLogfileGroupStmt is a statement to create a logfile group (NDB). See https://dev.mysql.com/doc/refman/8.4/en/create-logfile-group.html

func (*CreateLogfileGroupStmt) Accept

func (n *CreateLogfileGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateLogfileGroupStmt) Restore

func (n *CreateLogfileGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateProcedureStmt

type CreateProcedureStmt struct {
	IfNotExists bool
	Definer     *auth.UserIdentity
	Name        *TableName
	Params      []*RoutineParam
	Options     []*RoutineOption
	Body        StmtNode // nil when HasBodyStr
	BodyStr     string   // AS 'text' body of an external language routine
	HasBodyStr  bool
	// contains filtered or unexported fields
}

CreateProcedureStmt is a statement to create a stored procedure. See https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html

func (*CreateProcedureStmt) Accept

func (n *CreateProcedureStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateProcedureStmt) Restore

func (n *CreateProcedureStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateResourceGroupStmt

type CreateResourceGroupStmt struct {
	Name CIStr
	// System is TYPE = SYSTEM; otherwise TYPE = USER.
	System         bool
	Vcpus          []VcpuRange
	ThreadPriority *int64
	Enable         *bool
	// contains filtered or unexported fields
}

CreateResourceGroupStmt is a CREATE RESOURCE GROUP statement. See https://dev.mysql.com/doc/refman/8.0/en/create-resource-group.html

func (*CreateResourceGroupStmt) Accept

func (n *CreateResourceGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateResourceGroupStmt) Restore

Restore implements Node interface.

type CreateServerStmt

type CreateServerStmt struct {
	Name CIStr
	// Wrapper is the FOREIGN DATA WRAPPER name, an identifier or a
	// string literal depending on WrapperString.
	Wrapper       string
	WrapperString bool
	Options       []*ServerOption
	// contains filtered or unexported fields
}

CreateServerStmt is a CREATE SERVER statement (FEDERATED tables). See https://dev.mysql.com/doc/refman/8.0/en/create-server.html

func (*CreateServerStmt) Accept

func (n *CreateServerStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateServerStmt) Restore

func (n *CreateServerStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateSpatialRefSysStmt

type CreateSpatialRefSysStmt struct {
	OrReplace   bool
	IfNotExists bool
	SRID        uint64
	Attributes  []*SRSAttribute
	// contains filtered or unexported fields
}

CreateSpatialRefSysStmt is a statement to create a spatial reference system. See https://dev.mysql.com/doc/refman/8.4/en/create-spatial-reference-system.html

func (*CreateSpatialRefSysStmt) Accept

func (n *CreateSpatialRefSysStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateSpatialRefSysStmt) Restore

Restore implements Node interface.

type CreateTableStmt

type CreateTableStmt struct {
	IfNotExists bool
	TemporaryKeyword
	// Meanless when TemporaryKeyword is not TemporaryGlobal.
	// ON COMMIT DELETE ROWS => true
	// ON COMMIT PRESERVE ROW => false
	OnCommitDelete bool
	Table          *TableName
	ReferTable     *TableName
	Cols           []*ColumnDef
	Constraints    []*Constraint
	Options        []*TableOption
	Partition      *PartitionOptions
	OnDuplicate    OnDuplicateKeyHandlingType
	Select         ResultSetNode
	// StartTransaction is the trailing START TRANSACTION clause that MySQL
	// 8.0.21+ writes to the binary log in place of the SELECT part of
	// CREATE TABLE ... SELECT under row-based replication. Mutually
	// exclusive with Select.
	StartTransaction bool
	// contains filtered or unexported fields
}

CreateTableStmt is a statement to create a table. See https://dev.mysql.com/doc/refman/5.7/en/create-table.html

func (*CreateTableStmt) Accept

func (n *CreateTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateTableStmt) Restore

func (n *CreateTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateTablespaceStmt

type CreateTablespaceStmt struct {
	Undo         bool
	Name         CIStr
	DataFile     string
	HasDataFile  bool
	LogfileGroup CIStr // USE LOGFILE GROUP
	Options      []*TablespaceOption
	// contains filtered or unexported fields
}

CreateTablespaceStmt is a statement to create a tablespace. See https://dev.mysql.com/doc/refman/8.4/en/create-tablespace.html

func (*CreateTablespaceStmt) Accept

func (n *CreateTablespaceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateTablespaceStmt) Restore

func (n *CreateTablespaceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateTriggerStmt

type CreateTriggerStmt struct {
	IfNotExists  bool
	Definer      *auth.UserIdentity
	Name         *TableName
	Time         TriggerTime
	Event        TriggerEvent
	Table        *TableName
	Order        TriggerOrder
	OtherTrigger CIStr
	Body         StmtNode
	// contains filtered or unexported fields
}

CreateTriggerStmt is a statement to create a trigger. See https://dev.mysql.com/doc/refman/8.4/en/create-trigger.html

func (*CreateTriggerStmt) Accept

func (n *CreateTriggerStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateTriggerStmt) Restore

func (n *CreateTriggerStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateUserStmt

type CreateUserStmt struct {
	IsCreateRole             bool
	IfNotExists              bool
	Specs                    []*UserSpec
	DefaultRoles             []*auth.RoleIdentity
	AuthTokenOrTLSOptions    []*AuthTokenOrTLSOption
	ResourceOptions          []*ResourceOption
	PasswordOrLockOptions    []*PasswordOrLockOption
	CommentOrAttributeOption *CommentOrAttributeOption
	ResourceGroupNameOption  *ResourceGroupNameOption
	// contains filtered or unexported fields
}

CreateUserStmt creates user account. See https://dev.mysql.com/doc/refman/8.0/en/create-user.html

func (*CreateUserStmt) Accept

func (n *CreateUserStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateUserStmt) Restore

func (n *CreateUserStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type CreateViewStmt

type CreateViewStmt struct {
	OrReplace   bool
	IfNotExists bool
	ViewName    *TableName
	Cols        []CIStr
	Select      StmtNode
	SchemaCols  []CIStr
	Algorithm   ViewAlgorithm
	Definer     *auth.UserIdentity
	Security    ViewSecurity
	CheckOption ViewCheckOption
	// contains filtered or unexported fields
}

CreateViewStmt is a statement to create a View. See https://dev.mysql.com/doc/refman/5.7/en/create-view.html

func (*CreateViewStmt) Accept

func (n *CreateViewStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*CreateViewStmt) Restore

func (n *CreateViewStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DDLNode

type DDLNode interface {
	StmtNode
	// contains filtered or unexported methods
}

DDLNode represents DDL statement node.

type DMLNode

type DMLNode interface {
	StmtNode
	// contains filtered or unexported methods
}

DMLNode represents DML statement node.

type DatabaseOption

type DatabaseOption struct {
	Tp        DatabaseOptionType
	Value     string
	UintValue uint64
}

DatabaseOption represents database option.

func (*DatabaseOption) Restore

func (n *DatabaseOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DatabaseOptionType

type DatabaseOptionType int

DatabaseOptionType is the type for database options.

const (
	DatabaseOptionNone DatabaseOptionType = iota
	DatabaseOptionCharset
	DatabaseOptionCollate
	DatabaseOptionEncryption
	DatabaseOptionReadOnly
)

Database option types.

type DateArithType

type DateArithType byte

DateArithType is type for DateArith type.

type Datum

type Datum struct {
	// contains filtered or unexported fields
}

Datum is a data box holds different kind of data. It has better performance and is easier to use than `interface{}`.

func (*Datum) GetBinaryLiteral

func (d *Datum) GetBinaryLiteral() BinaryLiteral

GetBinaryLiteral gets Bit value

func (*Datum) GetBytes

func (d *Datum) GetBytes() []byte

GetBytes gets bytes value.

func (*Datum) GetFloat32

func (d *Datum) GetFloat32() float32

GetFloat32 gets float32 value.

func (*Datum) GetFloat64

func (d *Datum) GetFloat64() float64

GetFloat64 gets float64 value.

func (*Datum) GetInt64

func (d *Datum) GetInt64() int64

GetInt64 gets int64 value.

func (*Datum) GetInterface

func (d *Datum) GetInterface() any

GetInterface gets interface value.

func (*Datum) GetMysqlDecimal

func (d *Datum) GetMysqlDecimal() *MyDecimal

GetMysqlDecimal gets decimal value

func (*Datum) GetString

func (d *Datum) GetString() string

GetString gets string value.

func (*Datum) GetUint64

func (d *Datum) GetUint64() uint64

GetUint64 gets uint64 value.

func (*Datum) GetValue

func (d *Datum) GetValue() any

GetValue gets the value of the datum of any kind.

func (*Datum) Kind

func (d *Datum) Kind() byte

Kind gets the kind of the datum.

func (*Datum) SetBinaryLiteral

func (d *Datum) SetBinaryLiteral(b BinaryLiteral)

SetBinaryLiteral sets Bit value

func (*Datum) SetBytes

func (d *Datum) SetBytes(b []byte)

SetBytes sets bytes value to datum.

func (*Datum) SetBytesAsString

func (d *Datum) SetBytesAsString(b []byte)

SetBytesAsString sets bytes value to datum as string type.

func (*Datum) SetFloat32

func (d *Datum) SetFloat32(f float32)

SetFloat32 sets float32 value.

func (*Datum) SetFloat64

func (d *Datum) SetFloat64(f float64)

SetFloat64 sets float64 value.

func (*Datum) SetInt64

func (d *Datum) SetInt64(i int64)

SetInt64 sets int64 value.

func (*Datum) SetInterface

func (d *Datum) SetInterface(x any)

SetInterface sets interface to datum.

func (*Datum) SetMysqlDecimal

func (d *Datum) SetMysqlDecimal(b *MyDecimal)

SetMysqlDecimal sets decimal value

func (*Datum) SetNull

func (d *Datum) SetNull()

SetNull sets datum to nil.

func (*Datum) SetString

func (d *Datum) SetString(s string)

SetString sets string value.

func (*Datum) SetUint64

func (d *Datum) SetUint64(i uint64)

SetUint64 sets uint64 value.

func (*Datum) SetValue

func (d *Datum) SetValue(val any)

SetValue sets any kind of value.

type DeallocateStmt

type DeallocateStmt struct {
	Name string
	// contains filtered or unexported fields
}

DeallocateStmt is a statement to release PreparedStmt. See https://dev.mysql.com/doc/refman/5.7/en/deallocate-prepare.html

func (*DeallocateStmt) Accept

func (n *DeallocateStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeallocateStmt) Restore

func (n *DeallocateStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DeclareConditionStmt

type DeclareConditionStmt struct {
	Name      CIStr
	Condition *HandlerCondition // error code or SQLSTATE form
	// contains filtered or unexported fields
}

DeclareConditionStmt is a DECLARE ... CONDITION statement in a compound body.

func (*DeclareConditionStmt) Accept

func (n *DeclareConditionStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeclareConditionStmt) Restore

func (n *DeclareConditionStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DeclareCursorStmt

type DeclareCursorStmt struct {
	Name   CIStr
	Select StmtNode
	// contains filtered or unexported fields
}

DeclareCursorStmt is a DECLARE ... CURSOR statement in a compound body.

func (*DeclareCursorStmt) Accept

func (n *DeclareCursorStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeclareCursorStmt) Restore

func (n *DeclareCursorStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DeclareHandlerStmt

type DeclareHandlerStmt struct {
	Action     HandlerAction
	Conditions []*HandlerCondition
	Handler    StmtNode
	// contains filtered or unexported fields
}

DeclareHandlerStmt is a DECLARE ... HANDLER statement in a compound body.

func (*DeclareHandlerStmt) Accept

func (n *DeclareHandlerStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeclareHandlerStmt) Restore

func (n *DeclareHandlerStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DeclareVarStmt

type DeclareVarStmt struct {
	Names   []CIStr
	Type    *types.FieldType
	Default ExprNode
	// contains filtered or unexported fields
}

DeclareVarStmt is a DECLARE variable statement in a compound body.

func (*DeclareVarStmt) Accept

func (n *DeclareVarStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeclareVarStmt) Restore

func (n *DeclareVarStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DefaultExpr

type DefaultExpr struct {

	// Name is the column name.
	Name *ColumnName
	// contains filtered or unexported fields
}

DefaultExpr is the default expression using default value for a column.

func (*DefaultExpr) Accept

func (n *DefaultExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DefaultExpr) GetType

func (en *DefaultExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*DefaultExpr) Restore

func (n *DefaultExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*DefaultExpr) SetType

func (en *DefaultExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type DeleteStmt

type DeleteStmt struct {

	// TableRefs is used in both single table and multiple table delete statement.
	TableRefs *TableRefsClause
	// Tables is only used in multiple table delete statement.
	Tables       *DeleteTableList
	Where        ExprNode
	Order        *OrderByClause
	Limit        *Limit
	Priority     mysql.PriorityEnum
	IgnoreErr    bool
	Quick        bool
	IsMultiTable bool
	BeforeFrom   bool
	// TableHints represents the table level Optimizer Hint for join type.
	TableHints []*TableOptimizerHint
	With       *WithClause
	// contains filtered or unexported fields
}

DeleteStmt is a statement to delete rows from table. See https://dev.mysql.com/doc/refman/5.7/en/delete.html

func (*DeleteStmt) Accept

func (n *DeleteStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeleteStmt) Restore

func (n *DeleteStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*DeleteStmt) SetWhereExpr

func (n *DeleteStmt) SetWhereExpr(e ExprNode)

SetWhereExpr implements ShardableDMLStmt interface.

func (*DeleteStmt) TableRefsJoin

func (n *DeleteStmt) TableRefsJoin() (*Join, bool)

TableRefsJoin implements ShardableDMLStmt interface.

func (*DeleteStmt) WhereExpr

func (n *DeleteStmt) WhereExpr() ExprNode

WhereExpr implements ShardableDMLStmt interface.

type DeleteTableList

type DeleteTableList struct {
	Tables []*TableName
	// contains filtered or unexported fields
}

DeleteTableList is the tablelist used in delete statement multi-table mode.

func (*DeleteTableList) Accept

func (n *DeleteTableList) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DeleteTableList) OriginTextPosition

func (n *DeleteTableList) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*DeleteTableList) OriginalText

func (n *DeleteTableList) OriginalText() string

OriginalText implements Node interface.

func (*DeleteTableList) Restore

func (n *DeleteTableList) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*DeleteTableList) SetNoBackslashEscapes

func (n *DeleteTableList) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*DeleteTableList) SetOriginTextPosition

func (n *DeleteTableList) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*DeleteTableList) SetText

func (n *DeleteTableList) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*DeleteTableList) Text

func (n *DeleteTableList) Text() string

Text implements Node interface.

type DiagnosticsItem

type DiagnosticsItem struct {
	Target ExprNode
	Name   string
}

DiagnosticsItem is one `target = item_name` element of GET DIAGNOSTICS.

type DiagnosticsScope

type DiagnosticsScope int

DiagnosticsScope is the optional scope of a GET DIAGNOSTICS statement.

const (
	DiagnosticsScopeNone DiagnosticsScope = iota
	DiagnosticsScopeCurrent
	DiagnosticsScopeStacked
)

DiagnosticsScope values.

type DoStmt

type DoStmt struct {
	Exprs []ExprNode
	// contains filtered or unexported fields
}

DoStmt is the struct for DO statement.

func (*DoStmt) Accept

func (n *DoStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DoStmt) Restore

func (n *DoStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropDatabaseStmt

type DropDatabaseStmt struct {
	IfExists bool
	Name     CIStr
	// contains filtered or unexported fields
}

DropDatabaseStmt is a statement to drop a database and all tables in the database. See https://dev.mysql.com/doc/refman/5.7/en/drop-database.html

func (*DropDatabaseStmt) Accept

func (n *DropDatabaseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropDatabaseStmt) Restore

func (n *DropDatabaseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropIndexStmt

type DropIndexStmt struct {
	IndexName string
	Table     *TableName
	LockAlg   *IndexLockAndAlgorithm
	// contains filtered or unexported fields
}

DropIndexStmt is a statement to drop the index. See https://dev.mysql.com/doc/refman/5.7/en/drop-index.html

func (*DropIndexStmt) Accept

func (n *DropIndexStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropIndexStmt) Restore

func (n *DropIndexStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropLibraryStmt

type DropLibraryStmt struct {
	IfExists bool
	Library  *TableName
	// contains filtered or unexported fields
}

DropLibraryStmt is a statement to drop a library (MySQL 9.x). See https://dev.mysql.com/doc/refman/9.4/en/drop-library.html

func (*DropLibraryStmt) Accept

func (n *DropLibraryStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropLibraryStmt) Restore

func (n *DropLibraryStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropLogfileGroupStmt

type DropLogfileGroupStmt struct {
	Name    CIStr
	Options []*TablespaceOption
	// contains filtered or unexported fields
}

DropLogfileGroupStmt is a statement to drop a logfile group (NDB). See https://dev.mysql.com/doc/refman/8.4/en/drop-logfile-group.html

func (*DropLogfileGroupStmt) Accept

func (n *DropLogfileGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropLogfileGroupStmt) Restore

func (n *DropLogfileGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropResourceGroupStmt

type DropResourceGroupStmt struct {
	Name  CIStr
	Force bool
	// contains filtered or unexported fields
}

DropResourceGroupStmt is a DROP RESOURCE GROUP statement.

func (*DropResourceGroupStmt) Accept

func (n *DropResourceGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropResourceGroupStmt) Restore

func (n *DropResourceGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropRoutineStmt

type DropRoutineStmt struct {
	Tp       RoutineType
	IfExists bool
	Name     *TableName
	// contains filtered or unexported fields
}

DropRoutineStmt is a statement to drop a procedure, function, trigger or event.

func (*DropRoutineStmt) Accept

func (n *DropRoutineStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropRoutineStmt) Restore

func (n *DropRoutineStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropServerStmt

type DropServerStmt struct {
	IfExists bool
	Name     CIStr
	// contains filtered or unexported fields
}

DropServerStmt is a DROP SERVER statement.

func (*DropServerStmt) Accept

func (n *DropServerStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropServerStmt) Restore

func (n *DropServerStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropSpatialRefSysStmt

type DropSpatialRefSysStmt struct {
	IfExists bool
	SRID     uint64
	// contains filtered or unexported fields
}

DropSpatialRefSysStmt is a statement to drop a spatial reference system. See https://dev.mysql.com/doc/refman/8.4/en/drop-spatial-reference-system.html

func (*DropSpatialRefSysStmt) Accept

func (n *DropSpatialRefSysStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropSpatialRefSysStmt) Restore

func (n *DropSpatialRefSysStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropTableStmt

type DropTableStmt struct {
	IfExists         bool
	Tables           []*TableName
	IsView           bool
	TemporaryKeyword // make sense ONLY if/when IsView == false
	// contains filtered or unexported fields
}

DropTableStmt is a statement to drop one or more tables. See https://dev.mysql.com/doc/refman/5.7/en/drop-table.html

func (*DropTableStmt) Accept

func (n *DropTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropTableStmt) Restore

func (n *DropTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropTablespaceStmt

type DropTablespaceStmt struct {
	Undo    bool
	Name    CIStr
	Options []*TablespaceOption
	// contains filtered or unexported fields
}

DropTablespaceStmt is a statement to drop a tablespace. See https://dev.mysql.com/doc/refman/8.4/en/drop-tablespace.html

func (*DropTablespaceStmt) Accept

func (n *DropTablespaceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropTablespaceStmt) Restore

func (n *DropTablespaceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DropUserStmt

type DropUserStmt struct {
	IfExists   bool
	IsDropRole bool
	UserList   []*auth.UserIdentity
	// contains filtered or unexported fields
}

DropUserStmt creates user account. See http://dev.mysql.com/doc/refman/5.7/en/drop-user.html

func (*DropUserStmt) Accept

func (n *DropUserStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*DropUserStmt) Restore

func (n *DropUserStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type DualPasswordOptionType

type DualPasswordOptionType int

DualPasswordOptionType identifies the per-UserSpec MySQL 8.0 dual-password clause (RETAIN CURRENT PASSWORD or DISCARD OLD PASSWORD). The grammar attaches it to the UserSpec rather than to AlterUserStmt because MySQL allows different dual-password actions per spec inside a multi-user ALTER USER statement. The zero value means "no dual-password clause".

const (
	// DualPasswordRetainCurrent corresponds to RETAIN CURRENT PASSWORD.
	DualPasswordRetainCurrent DualPasswordOptionType = iota + 1
	// DualPasswordDiscardOld corresponds to DISCARD OLD PASSWORD.
	DualPasswordDiscardOld
)

func (DualPasswordOptionType) Restore

Restore implements Node interface.

type EventCompletion

type EventCompletion int

EventCompletion is the ON COMPLETION behavior of an event.

const (
	EventCompletionDefault EventCompletion = iota
	EventCompletionPreserve
	EventCompletionNotPreserve
)

EventCompletion values.

type EventSchedule

type EventSchedule struct {
	At     ExprNode // AT timestamp form
	Every  ExprNode // EVERY interval form
	Unit   TimeUnitType
	Starts ExprNode
	Ends   ExprNode
}

EventSchedule is the ON SCHEDULE clause of an event.

func (*EventSchedule) Restore

func (n *EventSchedule) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type EventStatus

type EventStatus int

EventStatus is the ENABLE/DISABLE state of an event.

const (
	EventStatusDefault EventStatus = iota
	EventStatusEnable
	EventStatusDisable
	EventStatusDisableOnReplica
)

EventStatus values.

type ExecuteStmt

type ExecuteStmt struct {
	Name       string
	UsingVars  []ExprNode
	BinaryArgs any
	PrepStmt   any // the corresponding prepared statement
	PrepStmtId uint32
	IdxInMulti int

	// FromGeneralStmt indicates whether this execute-stmt is converted from a general query.
	// e.g. select * from t where a>2 --> execute 'select * from t where a>?' using 2
	FromGeneralStmt bool
	// contains filtered or unexported fields
}

ExecuteStmt is a statement to execute PreparedStmt. See https://dev.mysql.com/doc/refman/5.7/en/execute.html

func (*ExecuteStmt) Accept

func (n *ExecuteStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ExecuteStmt) Restore

func (n *ExecuteStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ExistsSubqueryExpr

type ExistsSubqueryExpr struct {

	// Sel is the subquery, may be rewritten to other type of expression.
	Sel ExprNode
	// Not is true, the expression is "not exists".
	Not bool
	// contains filtered or unexported fields
}

ExistsSubqueryExpr is the expression for "exists (select ...)". See https://dev.mysql.com/doc/refman/5.7/en/exists-and-not-exists-subqueries.html

func (*ExistsSubqueryExpr) Accept

func (n *ExistsSubqueryExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ExistsSubqueryExpr) GetType

func (en *ExistsSubqueryExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ExistsSubqueryExpr) Restore

func (n *ExistsSubqueryExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ExistsSubqueryExpr) SetType

func (en *ExistsSubqueryExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type ExplainForStmt

type ExplainForStmt struct {
	Format       string
	ConnectionID uint64
	// contains filtered or unexported fields
}

ExplainForStmt is a statement to provite information about how is SQL statement executeing in connection #ConnectionID See https://dev.mysql.com/doc/refman/5.7/en/explain.html

func (*ExplainForStmt) Accept

func (n *ExplainForStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ExplainForStmt) Restore

func (n *ExplainForStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ExplainStmt

type ExplainStmt struct {
	Stmt    StmtNode
	Format  string
	Analyze bool

	// IntoVar is the raw @variable token of `EXPLAIN ... INTO @var`,
	// including the leading '@'. Empty when no INTO clause was given.
	IntoVar string

	// ForSchema is the schema name of `EXPLAIN ... FOR {SCHEMA|DATABASE} name`.
	// Empty when no FOR SCHEMA clause was given.
	ForSchema string

	// Explore indicates whether to use EXPLAIN EXPLORE.
	Explore bool
	// SQLDigest to explain, used in `EXPLAIN EXPLORE <sql_digest>`.
	SQLDigest string
	// PlanDigest to explain, used in `EXPLAIN [ANALYZE] <plan_digest>`.
	PlanDigest string
	// contains filtered or unexported fields
}

ExplainStmt is a statement to provide information about how is SQL statement executed or get columns information in a table. See https://dev.mysql.com/doc/refman/5.7/en/explain.html

func (*ExplainStmt) Accept

func (n *ExplainStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ExplainStmt) Restore

func (n *ExplainStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ExprNode

type ExprNode interface {
	// Node is embedded in ExprNode.
	Node
	// SetType sets evaluation type to the expression.
	SetType(tp *types.FieldType)
	// GetType gets the evaluation type of the expression.
	GetType() *types.FieldType
}

Flags indicates whether an expression contains certain types of expression. ExprNode is a node that can be evaluated. Name of implementations should have 'Expr' suffix.

type FactorOp

type FactorOp int

FactorOp is the multi-factor authentication operation of an AlterUserFactorStmt.

const (
	FactorOpAdd FactorOp = iota + 1
	FactorOpModify
	FactorOpDrop
	FactorOpInitiateRegistration
	FactorOpFinishRegistration
	FactorOpUnregister
)

FactorOp values.

type FetchCursorStmt

type FetchCursorStmt struct {
	Name CIStr
	Vars []ExprNode
	// contains filtered or unexported fields
}

FetchCursorStmt is a FETCH cursor statement in a compound body.

func (*FetchCursorStmt) Accept

func (n *FetchCursorStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FetchCursorStmt) Restore

func (n *FetchCursorStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type FieldItem

type FieldItem struct {
	Type        int
	Value       string
	OptEnclosed bool
}

type FieldList

type FieldList struct {
	Fields []*SelectField
	// contains filtered or unexported fields
}

FieldList represents field list in select statement.

func (*FieldList) Accept

func (n *FieldList) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FieldList) OriginTextPosition

func (n *FieldList) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*FieldList) OriginalText

func (n *FieldList) OriginalText() string

OriginalText implements Node interface.

func (*FieldList) Restore

func (n *FieldList) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*FieldList) SetNoBackslashEscapes

func (n *FieldList) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*FieldList) SetOriginTextPosition

func (n *FieldList) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*FieldList) SetText

func (n *FieldList) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*FieldList) Text

func (n *FieldList) Text() string

Text implements Node interface.

type FieldsClause

type FieldsClause struct {
	Terminated           *string
	Enclosed             *string // length always <= 1 if not nil, see parser.y
	Escaped              *string // length always <= 1 if not nil, see parser.y
	OptEnclosed          bool
	DefinedNullBy        *string
	NullValueOptEnclosed bool
}

FieldsClause represents fields references clause in load data statement.

func (*FieldsClause) Restore

func (n *FieldsClause) Restore(ctx *format.RestoreCtx) error

Restore for FieldsClause

type FileLocRefTp

type FileLocRefTp int

FileLocRefTp indicates where the LOAD DATA file is located. See https://dev.mysql.com/doc/refman/8.0/en/load-data.html

const (
	// FileLocServer is used when there is no LOCAL keyword, meaning the data
	// file is located on the server host.
	FileLocServer FileLocRefTp = iota
	// FileLocClient is used when there's LOCAL keyword in SQL, which means the data file should be located on the MySQL
	// client.
	FileLocClient
)

type FloatOpt

type FloatOpt struct {
	Flen    int
	Decimal int
}

FloatOpt is used for parsing floating-point type option from SQL. See http://dev.mysql.com/doc/refman/5.7/en/floating-point-types.html

type FlushStmt

type FlushStmt struct {
	Tp              FlushStmtType // Privileges/Tables/...
	NoWriteToBinLog bool
	LogType         LogType
	Tables          []*TableName // For FlushTableStmt, if Tables is empty, it means flush all tables.
	ReadLock        bool
	ForExport       bool
	// Channel is the FOR CHANNEL of FLUSH RELAY LOGS.
	Channel string
	// ExtraTargets are the additional comma-separated flush targets when the
	// statement lists several, e.g. FLUSH STATUS, USER_RESOURCES. Only the
	// Tp, LogType and Channel fields of each entry are meaningful: the table
	// form cannot appear in a list.
	ExtraTargets []*FlushStmt
	// contains filtered or unexported fields
}

FlushStmt is a statement to flush tables/privileges/optimizer costs and so on.

func (*FlushStmt) Accept

func (n *FlushStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FlushStmt) Restore

func (n *FlushStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type FlushStmtType

type FlushStmtType int

FlushStmtType is the type for FLUSH statement.

const (
	FlushNone FlushStmtType = iota
	FlushTables
	FlushPrivileges
	FlushStatus
	FlushHosts
	FlushLogs
	FlushUserResources
	FlushOptimizerCosts
)

Flush statement types.

type FrameBound

type FrameBound struct {
	Type      BoundType
	UnBounded bool
	Expr      ExprNode
	// `Unit` is used to indicate the units in which the `Expr` should be interpreted.
	// For example: '2:30' MINUTE_SECOND.
	Unit TimeUnitType
	// contains filtered or unexported fields
}

FrameBound represents frame bound.

func (*FrameBound) Accept

func (n *FrameBound) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FrameBound) OriginTextPosition

func (n *FrameBound) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*FrameBound) OriginalText

func (n *FrameBound) OriginalText() string

OriginalText implements Node interface.

func (*FrameBound) Restore

func (n *FrameBound) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*FrameBound) SetNoBackslashEscapes

func (n *FrameBound) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*FrameBound) SetOriginTextPosition

func (n *FrameBound) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*FrameBound) SetText

func (n *FrameBound) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*FrameBound) Text

func (n *FrameBound) Text() string

Text implements Node interface.

type FrameClause

type FrameClause struct {
	Type   FrameType
	Extent FrameExtent
	// contains filtered or unexported fields
}

FrameClause represents frame clause.

func (*FrameClause) Accept

func (n *FrameClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FrameClause) OriginTextPosition

func (n *FrameClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*FrameClause) OriginalText

func (n *FrameClause) OriginalText() string

OriginalText implements Node interface.

func (*FrameClause) Restore

func (n *FrameClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*FrameClause) SetNoBackslashEscapes

func (n *FrameClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*FrameClause) SetOriginTextPosition

func (n *FrameClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*FrameClause) SetText

func (n *FrameClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*FrameClause) Text

func (n *FrameClause) Text() string

Text implements Node interface.

type FrameExtent

type FrameExtent struct {
	Start FrameBound
	End   FrameBound
}

FrameExtent represents frame extent.

type FrameType

type FrameType int

FrameType is the type of window function frame.

type FulltextSearchModifier

type FulltextSearchModifier int

func (FulltextSearchModifier) IsBooleanMode

func (m FulltextSearchModifier) IsBooleanMode() bool

func (FulltextSearchModifier) IsNaturalLanguageMode

func (m FulltextSearchModifier) IsNaturalLanguageMode() bool

func (FulltextSearchModifier) WithQueryExpansion

func (m FulltextSearchModifier) WithQueryExpansion() bool

type FuncCallArgAliasExpr

type FuncCallArgAliasExpr struct {
	Expr   ExprNode
	AsName CIStr
	// contains filtered or unexported fields
}

FuncCallArgAliasExpr is a function call argument carrying MySQL's optional UDF attribute alias: udf_expr: expr [[AS] ident]. The server accepts the alias syntactically for any function and rejects non-UDF uses during resolution.

func (*FuncCallArgAliasExpr) Accept

func (n *FuncCallArgAliasExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FuncCallArgAliasExpr) GetType

func (en *FuncCallArgAliasExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*FuncCallArgAliasExpr) Restore

func (n *FuncCallArgAliasExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*FuncCallArgAliasExpr) SetType

func (en *FuncCallArgAliasExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type FuncCallExpr

type FuncCallExpr struct {
	Tp     FuncCallExprType
	Schema CIStr
	// FnName is the function name.
	FnName CIStr
	// Args is the function args.
	Args []ExprNode
	// contains filtered or unexported fields
}

FuncCallExpr is for function expression.

func (*FuncCallExpr) Accept

func (n *FuncCallExpr) Accept(v Visitor) (Node, bool)

Accept implements Node interface.

func (*FuncCallExpr) Restore

func (n *FuncCallExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type FuncCallExprType

type FuncCallExprType int8
const (
	FuncCallExprTypeKeyword FuncCallExprType = iota
	FuncCallExprTypeGeneric
)

type FuncCastExpr

type FuncCastExpr struct {

	// Expr is the expression to be converted.
	Expr ExprNode
	// Tp is the conversion type.
	Tp *types.FieldType
	// FunctionType is either Cast, Convert or Binary.
	FunctionType CastFunctionType
	// ExplicitCharSet is true when charset is explicit indicated.
	ExplicitCharSet bool
	// AtTimeZone is the time zone of CAST(expr AT TIME ZONE 'tz' AS DATETIME).
	AtTimeZone string
	// contains filtered or unexported fields
}

FuncCastExpr is the cast function converting value to another type, e.g, cast(expr AS signed). See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html

func (*FuncCastExpr) Accept

func (n *FuncCastExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*FuncCastExpr) Restore

func (n *FuncCastExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type FuncNode

type FuncNode interface {
	ExprNode
	// contains filtered or unexported methods
}

FuncNode represents function call expression node.

type GetDiagnosticsStmt

type GetDiagnosticsStmt struct {
	Scope DiagnosticsScope
	// ConditionNumber is non-nil for the CONDITION form.
	ConditionNumber ExprNode
	Items           []*DiagnosticsItem
	// contains filtered or unexported fields
}

GetDiagnosticsStmt is the GET [CURRENT|STACKED] DIAGNOSTICS statement. See https://dev.mysql.com/doc/refman/8.0/en/get-diagnostics.html

func (*GetDiagnosticsStmt) Accept

func (n *GetDiagnosticsStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GetDiagnosticsStmt) Restore

func (n *GetDiagnosticsStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GetFormatSelectorExpr

type GetFormatSelectorExpr struct {

	// Selector is the GET_FORMAT() selector.
	Selector GetFormatSelectorType
	// contains filtered or unexported fields
}

GetFormatSelectorExpr is an expression used as the first argument of GET_FORMAT() function.

func (*GetFormatSelectorExpr) Accept

func (n *GetFormatSelectorExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GetFormatSelectorExpr) GetType

func (en *GetFormatSelectorExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*GetFormatSelectorExpr) Restore

func (n *GetFormatSelectorExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*GetFormatSelectorExpr) SetType

func (en *GetFormatSelectorExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type GetFormatSelectorType

type GetFormatSelectorType int

GetFormatSelectorType is the type for the first argument of GET_FORMAT() function.

const (
	// GetFormatSelectorDate is the GET_FORMAT selector DATE.
	GetFormatSelectorDate GetFormatSelectorType = iota + 1
	// GetFormatSelectorTime is the GET_FORMAT selector TIME.
	GetFormatSelectorTime
	// GetFormatSelectorDatetime is the GET_FORMAT selector DATETIME and TIMESTAMP.
	GetFormatSelectorDatetime
)

func (GetFormatSelectorType) String

func (selector GetFormatSelectorType) String() string

String implements fmt.Stringer interface.

type GrantAsClause

type GrantAsClause struct {
	User *auth.UserIdentity
	// WithRole reports whether a WITH ROLE clause was present; SetRoleOpt's
	// zero value (SetRoleDefault) is a valid WITH ROLE DEFAULT otherwise.
	WithRole   bool
	SetRoleOpt SetRoleStmtType
	RoleList   []*auth.RoleIdentity
}

GrantAsClause is the trailing AS user [WITH ROLE ...] clause of GRANT (MySQL 8.0.16+): the grant is evaluated as if executed by the given user with the given roles active.

func (*GrantAsClause) Restore

func (n *GrantAsClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GrantLevel

type GrantLevel struct {
	Level     GrantLevelType
	DBName    string
	TableName string
}

GrantLevel is used for store the privilege scope.

func (*GrantLevel) Restore

func (n *GrantLevel) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GrantLevelType

type GrantLevelType int

GrantLevelType is the type for grant level.

const (
	// GrantLevelNone is the dummy const for default value.
	GrantLevelNone GrantLevelType = iota + 1
	// GrantLevelGlobal means the privileges are administrative or apply to all databases on a given server.
	GrantLevelGlobal
	// GrantLevelDB means the privileges apply to all objects in a given database.
	GrantLevelDB
	// GrantLevelTable means the privileges apply to all columns in a given table.
	GrantLevelTable
)

type GrantProxyStmt

type GrantProxyStmt struct {
	LocalUser     *auth.UserIdentity
	ExternalUsers []*auth.UserIdentity
	WithGrant     bool
	// contains filtered or unexported fields
}

GrantProxyStmt is the struct for GRANT PROXY statement.

func (*GrantProxyStmt) Accept

func (n *GrantProxyStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GrantProxyStmt) Restore

func (n *GrantProxyStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GrantRoleStmt

type GrantRoleStmt struct {
	Roles []*auth.RoleIdentity
	Users []*auth.UserIdentity
	// WithAdminOption is the trailing WITH ADMIN OPTION clause.
	WithAdminOption bool
	// contains filtered or unexported fields
}

GrantRoleStmt is the struct for GRANT TO statement.

func (*GrantRoleStmt) Accept

func (n *GrantRoleStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GrantRoleStmt) Restore

func (n *GrantRoleStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GrantStmt

type GrantStmt struct {
	Privs                 []*PrivElem
	ObjectType            ObjectTypeType
	Level                 *GrantLevel
	Users                 []*UserSpec
	AuthTokenOrTLSOptions []*AuthTokenOrTLSOption
	WithGrant             bool
	As                    *GrantAsClause
	// contains filtered or unexported fields
}

GrantStmt is the struct for GRANT statement.

func (*GrantStmt) Accept

func (n *GrantStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GrantStmt) Restore

func (n *GrantStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type GroupByClause

type GroupByClause struct {
	Items  []*ByItem
	Rollup bool
	// GroupingSets is non-nil for GROUP BY GROUPING SETS ((...), ...);
	// Items is empty in that case. An empty inner slice is the empty set ().
	GroupingSets [][]ExprNode
	// contains filtered or unexported fields
}

GroupByClause represents group by clause.

func (*GroupByClause) Accept

func (n *GroupByClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*GroupByClause) OriginTextPosition

func (n *GroupByClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*GroupByClause) OriginalText

func (n *GroupByClause) OriginalText() string

OriginalText implements Node interface.

func (*GroupByClause) Restore

func (n *GroupByClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*GroupByClause) SetNoBackslashEscapes

func (n *GroupByClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*GroupByClause) SetOriginTextPosition

func (n *GroupByClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*GroupByClause) SetText

func (n *GroupByClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*GroupByClause) Text

func (n *GroupByClause) Text() string

Text implements Node interface.

type HandlerAction

type HandlerAction int

HandlerAction is what a handler does after its statement runs.

const (
	HandlerActionContinue HandlerAction = iota
	HandlerActionExit
	HandlerActionUndo
)

HandlerAction values.

type HandlerCloseStmt

type HandlerCloseStmt struct {
	Handler CIStr
	// contains filtered or unexported fields
}

HandlerCloseStmt is a HANDLER ... CLOSE statement.

func (*HandlerCloseStmt) Accept

func (n *HandlerCloseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*HandlerCloseStmt) Restore

func (n *HandlerCloseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type HandlerCondition

type HandlerCondition struct {
	Tp    HandlerConditionType
	Code  uint64
	State string
	Name  CIStr
}

HandlerCondition is one condition value of a DECLARE HANDLER statement.

func (*HandlerCondition) Restore

func (n *HandlerCondition) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type HandlerConditionType

type HandlerConditionType int

HandlerConditionType is the kind of one handler condition value.

const (
	HandlerConditionErrorCode HandlerConditionType = iota
	HandlerConditionSQLState
	HandlerConditionName
	HandlerConditionSQLWarning
	HandlerConditionNotFound
	HandlerConditionSQLException
)

HandlerConditionType values.

type HandlerOpenStmt

type HandlerOpenStmt struct {
	Table  *TableName
	AsName CIStr
	// contains filtered or unexported fields
}

HandlerOpenStmt is a HANDLER ... OPEN statement. See https://dev.mysql.com/doc/refman/8.0/en/handler.html

func (*HandlerOpenStmt) Accept

func (n *HandlerOpenStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*HandlerOpenStmt) Restore

func (n *HandlerOpenStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type HandlerReadStmt

type HandlerReadStmt struct {
	Handler CIStr
	Index   CIStr
	// Direction is FIRST, NEXT, PREV or LAST; empty for value lookups.
	Direction string
	// CompareOp is =, <, >, <= or >= for value lookups.
	CompareOp string
	Values    []ExprNode
	Where     ExprNode
	Limit     *Limit
	// contains filtered or unexported fields
}

HandlerReadStmt is a HANDLER ... READ statement, in any of its three shapes: index-value lookup (Index + CompareOp + Values), index scan (Index + Direction), or natural-order table scan (Direction only, and only FIRST or NEXT).

func (*HandlerReadStmt) Accept

func (n *HandlerReadStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*HandlerReadStmt) Restore

func (n *HandlerReadStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type HavingClause

type HavingClause struct {
	Expr ExprNode
	// contains filtered or unexported fields
}

HavingClause represents having clause.

func (*HavingClause) Accept

func (n *HavingClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*HavingClause) OriginTextPosition

func (n *HavingClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*HavingClause) OriginalText

func (n *HavingClause) OriginalText() string

OriginalText implements Node interface.

func (*HavingClause) Restore

func (n *HavingClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*HavingClause) SetNoBackslashEscapes

func (n *HavingClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*HavingClause) SetOriginTextPosition

func (n *HavingClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*HavingClause) SetText

func (n *HavingClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*HavingClause) Text

func (n *HavingClause) Text() string

Text implements Node interface.

type HelpStmt

type HelpStmt struct {
	Topic string
	// contains filtered or unexported fields
}

HelpStmt is the HELP statement. See https://dev.mysql.com/doc/refman/8.0/en/help.html

func (*HelpStmt) Accept

func (n *HelpStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*HelpStmt) Restore

func (n *HelpStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type HexLiteral

type HexLiteral BinaryLiteral

HexLiteral is the hex literal type.

func NewHexLiteral

func NewHexLiteral(s string) (HexLiteral, error)

NewHexLiteral parses hexadecimal string as HexLiteral type.

func (HexLiteral) ToString

func (b HexLiteral) ToString() string

ToString returns the string representation for the literal.

type HintSetVar

type HintSetVar struct {
	VarName string
	Value   string
}

HintSetVar is the payload of `SET_VAR` hint

type HintTable

type HintTable struct {
	DBName    CIStr
	TableName CIStr
	QBName    CIStr
}

HintTable is table in the hint. It may have query block info.

func (*HintTable) Restore

func (ht *HintTable) Restore(ctx *format.RestoreCtx)

type HistogramOperationType

type HistogramOperationType int

HistogramOperationType is the type for histogram operation.

const (
	// HistogramOperationNop shows no operation in histogram. Default value.
	HistogramOperationNop HistogramOperationType = iota
	HistogramOperationUpdate
	HistogramOperationDrop
)

Histogram operation types.

func (HistogramOperationType) String

func (hot HistogramOperationType) String() string

String implements fmt.Stringer for HistogramOperationType.

type HistogramUpdateType

type HistogramUpdateType int

HistogramUpdateType is the MANUAL/AUTO UPDATE suffix of UPDATE HISTOGRAM.

const (
	HistogramUpdateNop HistogramUpdateType = iota
	HistogramUpdateManual
	HistogramUpdateAuto
)

Histogram update types.

type ImportTableStmt

type ImportTableStmt struct {
	Files []string
	// contains filtered or unexported fields
}

ImportTableStmt is an IMPORT TABLE FROM statement (SDI import). See https://dev.mysql.com/doc/refman/8.0/en/import-table.html

func (*ImportTableStmt) Accept

func (n *ImportTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ImportTableStmt) Restore

func (n *ImportTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type IndexHint

type IndexHint struct {
	IndexNames []CIStr
	HintType   IndexHintType
	HintScope  IndexHintScope
}

IndexHint represents a hint for optimizer to use/ignore/force for join/order by/group by.

func (*IndexHint) Restore

func (n *IndexHint) Restore(ctx *format.RestoreCtx) error

IndexHint Restore (The const field uses switch to facilitate understanding)

type IndexHintScope

type IndexHintScope int

IndexHintScope is the type for index hint for join, order by or group by.

const (
	HintForScan IndexHintScope = iota + 1
	HintForJoin
	HintForOrderBy
	HintForGroupBy
)

Index hint scopes.

type IndexHintType

type IndexHintType int

IndexHintType is the type for index hint use, ignore or force.

const (
	HintUse IndexHintType = iota + 1
	HintIgnore
	HintForce
	HintOrderIndex
	HintNoOrderIndex
)

IndexHintUseType values.

type IndexKeyType

type IndexKeyType int

IndexKeyType is the type for index key.

const (
	IndexKeyTypeNone IndexKeyType = iota
	IndexKeyTypeUnique
	IndexKeyTypeSpatial
	// IndexKeyTypeFulltext is only used in AST.
	// It will be rewritten into IndexKeyTypeFulltext after preprocessor phase.
	IndexKeyTypeFulltext
)

Index key types.

type IndexLockAndAlgorithm

type IndexLockAndAlgorithm struct {
	LockTp      LockType
	AlgorithmTp AlgorithmType
	// contains filtered or unexported fields
}

IndexLockAndAlgorithm stores the algorithm option and the lock option.

func (*IndexLockAndAlgorithm) Accept

func (n *IndexLockAndAlgorithm) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IndexLockAndAlgorithm) OriginTextPosition

func (n *IndexLockAndAlgorithm) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*IndexLockAndAlgorithm) OriginalText

func (n *IndexLockAndAlgorithm) OriginalText() string

OriginalText implements Node interface.

func (*IndexLockAndAlgorithm) Restore

func (n *IndexLockAndAlgorithm) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*IndexLockAndAlgorithm) SetNoBackslashEscapes

func (n *IndexLockAndAlgorithm) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*IndexLockAndAlgorithm) SetOriginTextPosition

func (n *IndexLockAndAlgorithm) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*IndexLockAndAlgorithm) SetText

func (n *IndexLockAndAlgorithm) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*IndexLockAndAlgorithm) Text

func (n *IndexLockAndAlgorithm) Text() string

Text implements Node interface.

type IndexOption

type IndexOption struct {
	KeyBlockSize        uint64
	Tp                  IndexType
	Comment             string
	ParserName          CIStr
	Visibility          IndexVisibility
	EngineAttr          string
	SecondaryEngineAttr string
	// contains filtered or unexported fields
}

IndexOption is the index options.

  KEY_BLOCK_SIZE [=] value
| index_type
| WITH PARSER parser_name
| COMMENT 'string'
| GLOBAL

See http://dev.mysql.com/doc/refman/5.7/en/create-table.html with the addition of Global Index

func (*IndexOption) Accept

func (n *IndexOption) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IndexOption) IsEmpty

func (n *IndexOption) IsEmpty() bool

IsEmpty is true if only default options are given and it should not be added to the output

func (*IndexOption) OriginTextPosition

func (n *IndexOption) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*IndexOption) OriginalText

func (n *IndexOption) OriginalText() string

OriginalText implements Node interface.

func (*IndexOption) Restore

func (n *IndexOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*IndexOption) SetNoBackslashEscapes

func (n *IndexOption) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*IndexOption) SetOriginTextPosition

func (n *IndexOption) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*IndexOption) SetText

func (n *IndexOption) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*IndexOption) Text

func (n *IndexOption) Text() string

Text implements Node interface.

type IndexPartSpecification

type IndexPartSpecification struct {
	Column *ColumnName
	Length int
	// Order is parsed but should be ignored because MySQL v5.7 doesn't support it.
	Desc bool
	Expr ExprNode
	// contains filtered or unexported fields
}

IndexPartSpecifications is used for parsing index column name or index expression from SQL.

func (*IndexPartSpecification) Accept

func (n *IndexPartSpecification) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IndexPartSpecification) OriginTextPosition

func (n *IndexPartSpecification) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*IndexPartSpecification) OriginalText

func (n *IndexPartSpecification) OriginalText() string

OriginalText implements Node interface.

func (*IndexPartSpecification) Restore

func (n *IndexPartSpecification) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*IndexPartSpecification) SetNoBackslashEscapes

func (n *IndexPartSpecification) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*IndexPartSpecification) SetOriginTextPosition

func (n *IndexPartSpecification) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*IndexPartSpecification) SetText

func (n *IndexPartSpecification) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*IndexPartSpecification) Text

func (n *IndexPartSpecification) Text() string

Text implements Node interface.

type IndexType

type IndexType int

IndexType is the type of index

const (
	IndexTypeInvalid IndexType = iota
	IndexTypeBtree
	IndexTypeHash
	IndexTypeRtree
	IndexTypeFulltext
)

IndexTypes

func (IndexType) String

func (t IndexType) String() string

String implements Stringer interface.

type IndexVisibility

type IndexVisibility int

IndexVisibility is the option for index visibility.

const (
	IndexVisibilityDefault IndexVisibility = iota
	IndexVisibilityVisible
	IndexVisibilityInvisible
)

IndexVisibility options.

type InsertStmt

type InsertStmt struct {
	IsReplace   bool
	IgnoreErr   bool
	Table       *TableRefsClause
	Columns     []*ColumnName
	Lists       [][]ExprNode
	Setlist     bool
	Priority    mysql.PriorityEnum
	OnDuplicate []*Assignment
	Select      ResultSetNode
	// TableHints represents the table level Optimizer Hint for join type.
	TableHints     []*TableOptimizerHint
	PartitionNames []CIStr
	// RowAlias is the optional row alias for VALUES/SET clause (MySQL 8.0.19+).
	// e.g. INSERT INTO t VALUES (1,2) AS new ON DUPLICATE KEY UPDATE b = new.b
	RowAlias CIStr
	// ColumnAliases is the optional column alias list for the row alias.
	// e.g. INSERT INTO t VALUES (1,2) AS new(m, n) ON DUPLICATE KEY UPDATE b = m
	ColumnAliases []CIStr
	// contains filtered or unexported fields
}

InsertStmt is a statement to insert new rows into an existing table. See https://dev.mysql.com/doc/refman/5.7/en/insert.html

func (*InsertStmt) Accept

func (n *InsertStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*InsertStmt) Restore

func (n *InsertStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*InsertStmt) SetWhereExpr

func (n *InsertStmt) SetWhereExpr(e ExprNode)

SetWhereExpr implements ShardableDMLStmt interface.

func (*InsertStmt) TableRefsJoin

func (n *InsertStmt) TableRefsJoin() (*Join, bool)

TableRefsJoin implements ShardableDMLStmt interface.

func (*InsertStmt) WhereExpr

func (n *InsertStmt) WhereExpr() ExprNode

WhereExpr implements ShardableDMLStmt interface.

type InstallComponentStmt

type InstallComponentStmt struct {
	Components []string
	SetVars    []*VariableAssignment
	// contains filtered or unexported fields
}

InstallComponentStmt is an INSTALL COMPONENT statement, with the optional 8.0.33+ SET clause for component system variables.

func (*InstallComponentStmt) Accept

func (n *InstallComponentStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*InstallComponentStmt) Restore

func (n *InstallComponentStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type InstallPluginStmt

type InstallPluginStmt struct {
	Name   CIStr
	SoName string
	// contains filtered or unexported fields
}

InstallPluginStmt is an INSTALL PLUGIN statement.

func (*InstallPluginStmt) Accept

func (n *InstallPluginStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*InstallPluginStmt) Restore

func (n *InstallPluginStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type IsNullExpr

type IsNullExpr struct {

	// Expr is the expression to be checked.
	Expr ExprNode
	// Not is true, the expression is "is not null".
	Not bool
	// contains filtered or unexported fields
}

IsNullExpr is the expression for null check.

func (*IsNullExpr) Accept

func (n *IsNullExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IsNullExpr) GetType

func (en *IsNullExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*IsNullExpr) Restore

func (n *IsNullExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*IsNullExpr) SetType

func (en *IsNullExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type IsTruthExpr

type IsTruthExpr struct {

	// Expr is the expression to be checked.
	Expr ExprNode
	// Not is true, the expression is "is not true/false".
	Not bool
	// True indicates checking true or false.
	True int64
	// contains filtered or unexported fields
}

IsTruthExpr is the expression for true/false check.

func (*IsTruthExpr) Accept

func (n *IsTruthExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IsTruthExpr) GetType

func (en *IsTruthExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*IsTruthExpr) Restore

func (n *IsTruthExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*IsTruthExpr) SetType

func (en *IsTruthExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type IterateStmt

type IterateStmt struct {
	Label CIStr
	// contains filtered or unexported fields
}

IterateStmt is an ITERATE statement in a compound body.

func (*IterateStmt) Accept

func (n *IterateStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*IterateStmt) Restore

func (n *IterateStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type JSONDualityObjectExpr

type JSONDualityObjectExpr struct {

	// With lists the operation annotations: WITH (INSERT, UPDATE, DELETE).
	With  []string
	Pairs []*JSONDualityObjectPair
	// contains filtered or unexported fields
}

JSONDualityObjectExpr is the JSON_DUALITY_OBJECT(...) constructor used in JSON duality view definitions. See https://dev.mysql.com/doc/refman/9.4/en/create-json-duality-view.html

func (*JSONDualityObjectExpr) Accept

func (n *JSONDualityObjectExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*JSONDualityObjectExpr) GetType

func (en *JSONDualityObjectExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*JSONDualityObjectExpr) Restore

func (n *JSONDualityObjectExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*JSONDualityObjectExpr) SetType

func (en *JSONDualityObjectExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type JSONDualityObjectPair

type JSONDualityObjectPair struct {
	Key   string
	Value ExprNode
}

JSONDualityObjectPair is one 'key' : value member of a JSON_DUALITY_OBJECT constructor.

type JSONSumCrc32Expr

type JSONSumCrc32Expr struct {

	// Expr is the expression to be converted.
	Expr ExprNode
	// Tp is the conversion type.
	Tp *types.FieldType
	// ExplicitCharSet is true when charset is explicit indicated.
	ExplicitCharSet bool
	// contains filtered or unexported fields
}

JSONSumCrc32Expr is the function to calculate sum of crc32 values for array in json It's modified from CastFunction to support processing JSON Array.

func (*JSONSumCrc32Expr) Accept

func (n *JSONSumCrc32Expr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*JSONSumCrc32Expr) Restore

func (n *JSONSumCrc32Expr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type JSONTableColumn

type JSONTableColumn struct {
	// Name is the column name; empty for NESTED entries.
	Name CIStr
	// ForOrdinality marks a `name FOR ORDINALITY` counter column.
	ForOrdinality bool
	// Tp is the column type of a value column; nil otherwise.
	Tp *types.FieldType
	// Exists marks an `EXISTS PATH` value column.
	Exists bool
	// Path is the JSON path literal of value and nested entries.
	Path string
	// OnEmpty is the ON EMPTY behavior of a value column; nil when absent.
	OnEmpty *JSONValueOnBehavior
	// OnError is the ON ERROR behavior of a value column; nil when absent.
	OnError *JSONValueOnBehavior
	// NestedColumns is non-nil for `NESTED [PATH] '...' COLUMNS (...)` entries.
	NestedColumns []*JSONTableColumn
}

JSONTableColumn is one column definition in the COLUMNS clause of JSON_TABLE. Exactly one of ForOrdinality, Tp (value column) and NestedColumns (NESTED PATH entry) is set.

func (*JSONTableColumn) Restore

func (n *JSONTableColumn) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type JSONTableExpr

type JSONTableExpr struct {

	// Doc is the JSON document argument.
	Doc ExprNode
	// Path is the row path literal.
	Path string
	// Columns is the COLUMNS clause.
	Columns []*JSONTableColumn
	// contains filtered or unexported fields
}

JSONTableExpr is the JSON_TABLE(doc, path COLUMNS (...)) table function used as a table factor.

func (*JSONTableExpr) Accept

func (n *JSONTableExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*JSONTableExpr) OriginTextPosition

func (n *JSONTableExpr) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*JSONTableExpr) OriginalText

func (n *JSONTableExpr) OriginalText() string

OriginalText implements Node interface.

func (*JSONTableExpr) Restore

func (n *JSONTableExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*JSONTableExpr) SetNoBackslashEscapes

func (n *JSONTableExpr) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*JSONTableExpr) SetOriginTextPosition

func (n *JSONTableExpr) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*JSONTableExpr) SetText

func (n *JSONTableExpr) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*JSONTableExpr) Text

func (n *JSONTableExpr) Text() string

Text implements Node interface.

type JSONValueBehaviorType

type JSONValueBehaviorType int

JSONValueBehaviorType is the type of behavior of JSON_VALUE's ON EMPTY and ON ERROR clauses.

const (
	// JSONValueBehaviorNull is NULL ON EMPTY/ERROR.
	JSONValueBehaviorNull JSONValueBehaviorType = iota
	// JSONValueBehaviorError is ERROR ON EMPTY/ERROR.
	JSONValueBehaviorError
	// JSONValueBehaviorDefault is DEFAULT <literal> ON EMPTY/ERROR.
	JSONValueBehaviorDefault
)

type JSONValueExpr

type JSONValueExpr struct {

	// Doc is the JSON document argument.
	Doc ExprNode
	// Path is the path expression argument.
	Path ExprNode
	// ReturningType is the RETURNING cast target; nil when absent.
	ReturningType *types.FieldType
	// ReturningExplicitCharset is true when the RETURNING type names a charset.
	ReturningExplicitCharset bool
	// OnEmpty is the ON EMPTY clause; nil when absent.
	OnEmpty *JSONValueOnBehavior
	// OnError is the ON ERROR clause; nil when absent.
	OnError *JSONValueOnBehavior
	// contains filtered or unexported fields
}

JSONValueExpr is JSON_VALUE(json_doc, path [RETURNING type] [on_empty] [on_error]).

func (*JSONValueExpr) Accept

func (n *JSONValueExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*JSONValueExpr) Restore

func (n *JSONValueExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type JSONValueOnBehavior

type JSONValueOnBehavior struct {
	Tp JSONValueBehaviorType
	// Default is the literal of DEFAULT <literal>; nil otherwise.
	Default ExprNode
}

JSONValueOnBehavior is one ON EMPTY or ON ERROR clause of JSON_VALUE.

func (*JSONValueOnBehavior) Restore

func (n *JSONValueOnBehavior) Restore(ctx *format.RestoreCtx) error

Restore writes the behavior keywords without the trailing ON EMPTY/ON ERROR.

type Join

type Join struct {

	// Left table can be TableSource or JoinNode.
	Left ResultSetNode
	// Right table can be TableSource or JoinNode or nil.
	Right ResultSetNode
	// Tp represents join type.
	Tp JoinType
	// On represents join on condition.
	On *OnCondition
	// Using represents join using clause.
	Using []*ColumnName
	// NaturalJoin represents join is natural join.
	NaturalJoin bool
	// StraightJoin represents a straight join.
	StraightJoin   bool
	ExplicitParens bool
	// contains filtered or unexported fields
}

Join represents table join.

func NewCrossJoin

func NewCrossJoin(left, right ResultSetNode) (n *Join)

NewCrossJoin builds a cross join without `on` or `using` clause. If the right child is a join tree, we need to handle it differently to make the precedence get right. Here is the example: t1 join t2 join t3

               JOIN ON t2.a = t3.a
t1    join    /    \
            t2      t3

(left) (right)

We can not build it directly to:

  JOIN
 /    \
t1	   JOIN ON t2.a = t3.a
      /   \
     t2    t3

The precedence would be t1 join (t2 join t3 on t2.a=t3.a), not (t1 join t2) join t3 on t2.a=t3.a We need to find the left-most child of the right child, and build a cross join of the left-hand side of the left child(t1), and the right hand side with the original left-most child of the right child(t2).

    JOIN t2.a = t3.a
   /    \
 JOIN    t3
 /  \
t1  t2

Besides, if the right handle side join tree's join type is right join and has explicit parentheses, we need to rewrite it to left join. So t1 join t2 right join t3 would be rewrite to t1 join t3 left join t2. If not, t1 join (t2 right join t3) would be (t1 join t2) right join t3. After rewrite the right join to left join. We get (t1 join t3) left join t2, the semantics is correct.

func (*Join) Accept

func (n *Join) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*Join) OriginTextPosition

func (n *Join) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*Join) OriginalText

func (n *Join) OriginalText() string

OriginalText implements Node interface.

func (*Join) Restore

func (n *Join) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*Join) SetNoBackslashEscapes

func (n *Join) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*Join) SetOriginTextPosition

func (n *Join) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*Join) SetText

func (n *Join) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*Join) Text

func (n *Join) Text() string

Text implements Node interface.

type JoinType

type JoinType int

JoinType is join type, including cross/left/right/full.

const (
	// CrossJoin is cross join type.
	CrossJoin JoinType = iota + 1
	// LeftJoin is left Join type.
	LeftJoin
	// RightJoin is right Join type.
	RightJoin
)

type KillStmt

type KillStmt struct {

	// Query indicates whether terminate a single query on this connection or the whole connection.
	// If Query is true, terminates the statement the connection is currently executing, but leaves the connection itself intact.
	// If Query is false, terminates the connection associated with the given ConnectionID, after terminating any statement the connection is executing.
	Query        bool
	ConnectionID uint64

	Expr ExprNode
	// contains filtered or unexported fields
}

KillStmt is a statement to kill a query or connection.

func (*KillStmt) Accept

func (n *KillStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*KillStmt) Restore

func (n *KillStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type LeaveStmt

type LeaveStmt struct {
	Label CIStr
	// contains filtered or unexported fields
}

LeaveStmt is a LEAVE statement in a compound body.

func (*LeaveStmt) Accept

func (n *LeaveStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LeaveStmt) Restore

func (n *LeaveStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type Limit

type Limit struct {
	Count  ExprNode
	Offset ExprNode
	// contains filtered or unexported fields
}

Limit is the limit clause.

func (*Limit) Accept

func (n *Limit) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*Limit) OriginTextPosition

func (n *Limit) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*Limit) OriginalText

func (n *Limit) OriginalText() string

OriginalText implements Node interface.

func (*Limit) Restore

func (n *Limit) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*Limit) SetNoBackslashEscapes

func (n *Limit) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*Limit) SetOriginTextPosition

func (n *Limit) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*Limit) SetText

func (n *Limit) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*Limit) Text

func (n *Limit) Text() string

Text implements Node interface.

type LinesClause

type LinesClause struct {
	Starting   *string
	Terminated *string
}

LinesClause represents lines references clause in load data statement.

func (*LinesClause) Restore

func (n *LinesClause) Restore(ctx *format.RestoreCtx) error

Restore for LinesClause

type LoadDataStmt

type LoadDataStmt struct {
	Xml               bool   // LOAD XML instead of LOAD DATA.
	XmlRowTag         string // ROWS IDENTIFIED BY '<tag>' of LOAD XML; empty when absent.
	LowPriority       bool
	Concurrent        bool
	InPrimaryKeyOrder bool // NDB-only IN PRIMARY KEY ORDER load hint.
	FileLocRef        FileLocRefTp
	Path              string
	OnDuplicate       OnDuplicateKeyHandlingType
	Table             *TableName
	Charset           *string
	Columns           []*ColumnName
	FieldsInfo        *FieldsClause
	LinesInfo         *LinesClause
	IgnoreLines       *uint64
	ColumnAssignments []*Assignment

	ColumnsAndUserVars []*ColumnNameOrUserVar
	// contains filtered or unexported fields
}

func (*LoadDataStmt) Accept

func (n *LoadDataStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LoadDataStmt) Restore

func (n *LoadDataStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type LoadIndexStmt

type LoadIndexStmt struct {
	TableIndexes []*CacheTableIndex
	// contains filtered or unexported fields
}

LoadIndexStmt is a LOAD INDEX INTO CACHE statement. See https://dev.mysql.com/doc/refman/8.0/en/load-index.html

func (*LoadIndexStmt) Accept

func (n *LoadIndexStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LoadIndexStmt) Restore

func (n *LoadIndexStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type LockInstanceStmt

type LockInstanceStmt struct {
	// contains filtered or unexported fields
}

LockInstanceStmt is a LOCK INSTANCE FOR BACKUP statement.

func (*LockInstanceStmt) Accept

func (n *LockInstanceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LockInstanceStmt) Restore

func (n *LockInstanceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type LockTablesStmt

type LockTablesStmt struct {
	TableLocks []TableLock
	// contains filtered or unexported fields
}

LockTablesStmt is a statement to lock tables.

func (*LockTablesStmt) Accept

func (n *LockTablesStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LockTablesStmt) Restore

func (n *LockTablesStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type LockType

type LockType byte

LockType is the type for AlterTableSpec. See https://dev.mysql.com/doc/refman/5.7/en/alter-table.html#alter-table-concurrency

const (
	LockTypeNone LockType = iota + 1
	LockTypeDefault
	LockTypeShared
	LockTypeExclusive
)

Lock Types.

func (LockType) String

func (n LockType) String() string

type LogType

type LogType int8

LogType is the log type used in FLUSH statement.

const (
	LogTypeDefault LogType = iota
	LogTypeBinary
	LogTypeEngine
	LogTypeError
	LogTypeGeneral
	LogTypeSlow
	LogTypeRelay
)

type LoopStmt

type LoopStmt struct {
	Label       CIStr
	HasEndLabel bool
	Stmts       []StmtNode
	// contains filtered or unexported fields
}

LoopStmt is a LOOP ... END LOOP loop in a compound body.

func (*LoopStmt) Accept

func (n *LoopStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*LoopStmt) Restore

func (n *LoopStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type MatchAgainst

type MatchAgainst struct {

	// ColumnNames are the columns to match.
	ColumnNames []*ColumnName
	// Against
	Against ExprNode
	// Modifier
	Modifier FulltextSearchModifier
	// contains filtered or unexported fields
}

MatchAgainst is the expression for matching against fulltext index.

func (*MatchAgainst) Accept

func (n *MatchAgainst) Accept(v Visitor) (Node, bool)

func (*MatchAgainst) GetType

func (en *MatchAgainst) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*MatchAgainst) Restore

func (n *MatchAgainst) Restore(ctx *format.RestoreCtx) error

func (*MatchAgainst) SetType

func (en *MatchAgainst) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type MatchType

type MatchType int

MatchType is the type for reference match type.

const (
	MatchNone MatchType = iota
	MatchFull
	MatchPartial
	MatchSimple
)

match type

type MaxValueExpr

type MaxValueExpr struct {
	// contains filtered or unexported fields
}

MaxValueExpr is the expression for "maxvalue" used in partition.

func (*MaxValueExpr) Accept

func (n *MaxValueExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*MaxValueExpr) GetType

func (en *MaxValueExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*MaxValueExpr) Restore

func (n *MaxValueExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*MaxValueExpr) SetType

func (en *MaxValueExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type MyDecimal

type MyDecimal struct {
	// contains filtered or unexported fields
}

MyDecimal represents a decimal value.

func NewDecimal

func NewDecimal(str string) (*MyDecimal, error)

NewDecimal parses a string into a MyDecimal value.

func (*MyDecimal) FromString

func (d *MyDecimal) FromString(str []byte) error

FromString parses decimal from string.

func (*MyDecimal) String

func (d *MyDecimal) String() string

String returns the decimal string representation rounded to resultFrac.

func (*MyDecimal) ToString

func (d *MyDecimal) ToString() (str []byte)

ToString converts decimal to its printable string representation without rounding.

RETURN VALUE

    str       - result string
    errCode   - eDecOK/eDecTruncate/eDecOverflow

type Node

type Node interface {
	// Restore returns the sql text from ast tree
	Restore(ctx *format.RestoreCtx) error
	// Accept accepts Visitor to visit itself.
	// The returned node should replace original node.
	// ok returns false to stop visiting.
	//
	// Implementation of this method should first call visitor.Enter,
	// assign the returned node to its method receiver, if skipChildren returns true,
	// children should be skipped. Otherwise, call its children in particular order that
	// later elements depends on former elements. Finally, return visitor.Leave.
	Accept(v Visitor) (node Node, ok bool)
	// Text returns the utf8 encoding text of the element.
	Text() string
	// OriginalText returns the original text of the element.
	OriginalText() string
	// SetText sets original text to the Node.
	SetText(enc charset.Encoding, text string)
	// SetOriginTextPosition set the start offset of this node in the origin text.
	// Only be called when `parser.lexer.skipPositionRecording` equals to false.
	SetOriginTextPosition(offset int)
	// OriginTextPosition get the start offset of this node in the origin text.
	OriginTextPosition() int
}

Node is the basic element of the AST. Interfaces embed Node should have 'Node' name suffix.

type NullString

type NullString struct {
	String string
	Empty  bool // Empty is true if String is empty backtick.
}

NullString represents a string that may be nil.

type ObjectTypeType

type ObjectTypeType int

ObjectTypeType is the type for object type.

const (
	// ObjectTypeNone is for empty object type.
	ObjectTypeNone ObjectTypeType = iota + 1
	// ObjectTypeTable means the following object is a table.
	ObjectTypeTable
	// ObjectTypeFunction means the following object is a stored function.
	ObjectTypeFunction
	// ObjectTypeProcedure means the following object is a stored procedure.
	ObjectTypeProcedure
	// ObjectTypeLibrary means the following object is a library (MySQL 9.x).
	ObjectTypeLibrary
)

func (ObjectTypeType) Restore

func (n ObjectTypeType) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type OnCondition

type OnCondition struct {
	Expr ExprNode
	// contains filtered or unexported fields
}

OnCondition represents JOIN on condition.

func (*OnCondition) Accept

func (n *OnCondition) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*OnCondition) OriginTextPosition

func (n *OnCondition) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*OnCondition) OriginalText

func (n *OnCondition) OriginalText() string

OriginalText implements Node interface.

func (*OnCondition) Restore

func (n *OnCondition) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*OnCondition) SetNoBackslashEscapes

func (n *OnCondition) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*OnCondition) SetOriginTextPosition

func (n *OnCondition) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*OnCondition) SetText

func (n *OnCondition) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*OnCondition) Text

func (n *OnCondition) Text() string

Text implements Node interface.

type OnDeleteOpt

type OnDeleteOpt struct {
	ReferOpt ReferOptionType
	// contains filtered or unexported fields
}

OnDeleteOpt is used for optional on delete clause.

func (*OnDeleteOpt) Accept

func (n *OnDeleteOpt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*OnDeleteOpt) OriginTextPosition

func (n *OnDeleteOpt) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*OnDeleteOpt) OriginalText

func (n *OnDeleteOpt) OriginalText() string

OriginalText implements Node interface.

func (*OnDeleteOpt) Restore

func (n *OnDeleteOpt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*OnDeleteOpt) SetNoBackslashEscapes

func (n *OnDeleteOpt) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*OnDeleteOpt) SetOriginTextPosition

func (n *OnDeleteOpt) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*OnDeleteOpt) SetText

func (n *OnDeleteOpt) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*OnDeleteOpt) Text

func (n *OnDeleteOpt) Text() string

Text implements Node interface.

type OnDuplicateKeyHandlingType

type OnDuplicateKeyHandlingType int

OnDuplicateKeyHandlingType is the option that handle unique key values in 'CREATE TABLE ... SELECT' or `LOAD DATA`. See https://dev.mysql.com/doc/refman/5.7/en/create-table-select.html See https://dev.mysql.com/doc/refman/5.7/en/load-data.html

const (
	OnDuplicateKeyHandlingError OnDuplicateKeyHandlingType = iota
	OnDuplicateKeyHandlingIgnore
	OnDuplicateKeyHandlingReplace
)

OnDuplicateKeyHandling types

type OnUpdateOpt

type OnUpdateOpt struct {
	ReferOpt ReferOptionType
	// contains filtered or unexported fields
}

OnUpdateOpt is used for optional on update clause.

func (*OnUpdateOpt) Accept

func (n *OnUpdateOpt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*OnUpdateOpt) OriginTextPosition

func (n *OnUpdateOpt) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*OnUpdateOpt) OriginalText

func (n *OnUpdateOpt) OriginalText() string

OriginalText implements Node interface.

func (*OnUpdateOpt) Restore

func (n *OnUpdateOpt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*OnUpdateOpt) SetNoBackslashEscapes

func (n *OnUpdateOpt) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*OnUpdateOpt) SetOriginTextPosition

func (n *OnUpdateOpt) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*OnUpdateOpt) SetText

func (n *OnUpdateOpt) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*OnUpdateOpt) Text

func (n *OnUpdateOpt) Text() string

Text implements Node interface.

type OpenCursorStmt

type OpenCursorStmt struct {
	Name CIStr
	// contains filtered or unexported fields
}

OpenCursorStmt is an OPEN cursor statement in a compound body.

func (*OpenCursorStmt) Accept

func (n *OpenCursorStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*OpenCursorStmt) Restore

func (n *OpenCursorStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type OptBinary

type OptBinary struct {
	IsBinary bool
	Charset  string
}

OptBinary is used for parser.

type OptimizeTableStmt

type OptimizeTableStmt struct {
	NoWriteToBinLog bool
	Tables          []*TableName
	// contains filtered or unexported fields
}

func (*OptimizeTableStmt) Accept

func (n *OptimizeTableStmt) Accept(v Visitor) (Node, bool)

func (*OptimizeTableStmt) Restore

func (n *OptimizeTableStmt) Restore(ctx *format.RestoreCtx) error

type OrderByClause

type OrderByClause struct {
	Items    []*ByItem
	ForUnion bool
	// contains filtered or unexported fields
}

OrderByClause represents order by clause.

func (*OrderByClause) Accept

func (n *OrderByClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*OrderByClause) OriginTextPosition

func (n *OrderByClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*OrderByClause) OriginalText

func (n *OrderByClause) OriginalText() string

OriginalText implements Node interface.

func (*OrderByClause) Restore

func (n *OrderByClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*OrderByClause) SetNoBackslashEscapes

func (n *OrderByClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*OrderByClause) SetOriginTextPosition

func (n *OrderByClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*OrderByClause) SetText

func (n *OrderByClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*OrderByClause) Text

func (n *OrderByClause) Text() string

Text implements Node interface.

type ParamMarkerExpr

type ParamMarkerExpr struct {
	ValueExpr
	Offset    int
	Order     int
	InExecute bool
}

ParamMarkerExpr expression holds a place for another expression. Used in parsing prepare statement.

func NewParamMarkerExpr

func NewParamMarkerExpr(offset int) *ParamMarkerExpr

NewParamMarkerExpr creates a ParamMarkerExpr.

func (*ParamMarkerExpr) Accept

func (n *ParamMarkerExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ParamMarkerExpr) GetType

func (en *ParamMarkerExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ParamMarkerExpr) Restore

func (n *ParamMarkerExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ParamMarkerExpr) SetOrder

func (n *ParamMarkerExpr) SetOrder(order int)

SetOrder sets the order of the parameter marker.

func (*ParamMarkerExpr) SetType

func (en *ParamMarkerExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type ParenthesesExpr

type ParenthesesExpr struct {

	// Expr is the expression in parentheses.
	Expr ExprNode
	// contains filtered or unexported fields
}

ParenthesesExpr is the parentheses' expression.

func (*ParenthesesExpr) Accept

func (n *ParenthesesExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ParenthesesExpr) GetType

func (en *ParenthesesExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ParenthesesExpr) Restore

func (n *ParenthesesExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ParenthesesExpr) SetType

func (en *ParenthesesExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type PartitionByClause

type PartitionByClause struct {
	Items []*ByItem
	// contains filtered or unexported fields
}

PartitionByClause represents partition by clause.

func (*PartitionByClause) Accept

func (n *PartitionByClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PartitionByClause) OriginTextPosition

func (n *PartitionByClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*PartitionByClause) OriginalText

func (n *PartitionByClause) OriginalText() string

OriginalText implements Node interface.

func (*PartitionByClause) Restore

func (n *PartitionByClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PartitionByClause) SetNoBackslashEscapes

func (n *PartitionByClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*PartitionByClause) SetOriginTextPosition

func (n *PartitionByClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*PartitionByClause) SetText

func (n *PartitionByClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*PartitionByClause) Text

func (n *PartitionByClause) Text() string

Text implements Node interface.

type PartitionDefinition

type PartitionDefinition struct {
	Name    CIStr
	Clause  PartitionDefinitionClause
	Options []*TableOption
	Sub     []*SubPartitionDefinition
}

PartitionDefinition defines a single partition.

func (*PartitionDefinition) Comment

func (n *PartitionDefinition) Comment() (string, bool)

Comment returns the comment option given to this definition. The second return value indicates if the comment option exists.

func (*PartitionDefinition) Restore

func (n *PartitionDefinition) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type PartitionDefinitionClause

type PartitionDefinitionClause interface {

	// Validate checks if the clause is consistent with the given options.
	// `pt` can be 0 and `columns` can be -1 to skip checking the clause against
	// the partition type or number of columns in the expression list.
	Validate(pt PartitionType, columns int) error
	// contains filtered or unexported methods
}

type PartitionDefinitionClauseIn

type PartitionDefinitionClauseIn struct {
	Values [][]ExprNode
}

func (*PartitionDefinitionClauseIn) Validate

func (n *PartitionDefinitionClauseIn) Validate(pt PartitionType, columns int) error

type PartitionDefinitionClauseLessThan

type PartitionDefinitionClauseLessThan struct {
	Exprs []ExprNode
}

func (*PartitionDefinitionClauseLessThan) Validate

func (n *PartitionDefinitionClauseLessThan) Validate(pt PartitionType, columns int) error

type PartitionDefinitionClauseNone

type PartitionDefinitionClauseNone struct{}

func (*PartitionDefinitionClauseNone) Validate

type PartitionKeyAlgorithm

type PartitionKeyAlgorithm struct {
	Type uint64
}

type PartitionMethod

type PartitionMethod struct {

	// Tp is the type of the partition function
	Tp PartitionType
	// Linear is a modifier to the HASH and KEY type for choosing a different
	// algorithm
	Linear bool
	// Expr is an expression used as argument of HASH, RANGE AND LIST types
	Expr ExprNode
	// ColumnNames is a list of column names used as argument of KEY,
	// RANGE COLUMNS and LIST COLUMNS types
	ColumnNames []*ColumnName

	// Num is the number of (sub)partitions required by the method.
	Num uint64

	// KeyAlgorithm is the optional hash algorithm type for `PARTITION BY [LINEAR] KEY` syntax.
	KeyAlgorithm *PartitionKeyAlgorithm
	// contains filtered or unexported fields
}

PartitionMethod describes how partitions or subpartitions are constructed.

func (*PartitionMethod) OriginTextPosition

func (n *PartitionMethod) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*PartitionMethod) OriginalText

func (n *PartitionMethod) OriginalText() string

OriginalText implements Node interface.

func (*PartitionMethod) Restore

func (n *PartitionMethod) Restore(ctx *format.RestoreCtx) error

Restore implements the Node interface

func (*PartitionMethod) SetNoBackslashEscapes

func (n *PartitionMethod) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*PartitionMethod) SetOriginTextPosition

func (n *PartitionMethod) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*PartitionMethod) SetText

func (n *PartitionMethod) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*PartitionMethod) Text

func (n *PartitionMethod) Text() string

Text implements Node interface.

type PartitionOptions

type PartitionOptions struct {
	PartitionMethod
	Sub         *PartitionMethod
	Definitions []*PartitionDefinition
}

PartitionOptions specifies the partition options.

func (*PartitionOptions) Accept

func (n *PartitionOptions) Accept(v Visitor) (Node, bool)

func (*PartitionOptions) OriginTextPosition

func (n *PartitionOptions) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*PartitionOptions) OriginalText

func (n *PartitionOptions) OriginalText() string

OriginalText implements Node interface.

func (*PartitionOptions) Restore

func (n *PartitionOptions) Restore(ctx *format.RestoreCtx) error

func (*PartitionOptions) SetNoBackslashEscapes

func (n *PartitionOptions) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*PartitionOptions) SetOriginTextPosition

func (n *PartitionOptions) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*PartitionOptions) SetText

func (n *PartitionOptions) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*PartitionOptions) Text

func (n *PartitionOptions) Text() string

Text implements Node interface.

func (*PartitionOptions) Validate

func (n *PartitionOptions) Validate() error

Validate checks if the partition is well-formed.

type PartitionType

type PartitionType int

PartitionType is the type for PartitionInfo

const (
	// Actually non-partitioned, but during DDL keeping the table as
	// a single partition
	PartitionTypeNone PartitionType = 0

	PartitionTypeRange PartitionType = 1
	PartitionTypeHash  PartitionType = 2
	PartitionTypeList  PartitionType = 3
	PartitionTypeKey   PartitionType = 4
)

PartitionType types.

func (PartitionType) String

func (p PartitionType) String() string

String implements fmt.Stringer interface.

type PasswordOrLockOption

type PasswordOrLockOption struct {
	Type  int
	Count int64
}

func (*PasswordOrLockOption) Restore

func (p *PasswordOrLockOption) Restore(ctx *format.RestoreCtx) error

type PatternInExpr

type PatternInExpr struct {

	// Expr is the value expression to be compared.
	Expr ExprNode
	// List is the list expression in compare list.
	List []ExprNode
	// Not is true, the expression is "not in".
	Not bool
	// Sel is the subquery, may be rewritten to other type of expression.
	Sel ExprNode
	// contains filtered or unexported fields
}

PatternInExpr is the expression for in operator, like "expr in (1, 2, 3)" or "expr in (select c from t)".

func (*PatternInExpr) Accept

func (n *PatternInExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PatternInExpr) GetType

func (en *PatternInExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*PatternInExpr) Restore

func (n *PatternInExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PatternInExpr) SetType

func (en *PatternInExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type PatternLikeExpr

type PatternLikeExpr struct {

	// Expr is the expression to be checked.
	Expr ExprNode
	// Pattern is the like expression.
	Pattern ExprNode
	// Not is true, the expression is "not like".
	Not bool

	Escape byte
	// EscapeExpr is a non-literal ESCAPE expression (MySQL accepts any simple
	// expression and validates the one-character requirement at execution
	// time). When set, Escape is 0 and the expression is restored verbatim.
	EscapeExpr ExprNode
	// EscapeExplicit indicates whether ESCAPE clause is specified explicitly.
	EscapeExplicit bool

	PatChars []byte
	PatTypes []byte
	// contains filtered or unexported fields
}

PatternLikeExpr is the expression for the LIKE operator, e.g. expr LIKE "%123%".

func (*PatternLikeExpr) Accept

func (n *PatternLikeExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PatternLikeExpr) GetType

func (en *PatternLikeExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*PatternLikeExpr) Restore

func (n *PatternLikeExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PatternLikeExpr) SetType

func (en *PatternLikeExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type PatternRegexpExpr

type PatternRegexpExpr struct {

	// Expr is the expression to be checked.
	Expr ExprNode
	// Pattern is the expression for pattern.
	Pattern ExprNode
	// Not is true, the expression is "not rlike",
	Not bool

	// Re is the compiled regexp.
	Re *regexp.Regexp
	// Sexpr is the string for Expr expression.
	Sexpr *string
	// contains filtered or unexported fields
}

PatternRegexpExpr is the pattern expression for pattern match.

func (*PatternRegexpExpr) Accept

func (n *PatternRegexpExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PatternRegexpExpr) GetType

func (en *PatternRegexpExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*PatternRegexpExpr) Restore

func (n *PatternRegexpExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PatternRegexpExpr) SetType

func (en *PatternRegexpExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type PositionExpr

type PositionExpr struct {

	// N is the position, started from 1 now.
	N int
	// P is the parameterized position.
	P ExprNode
	// contains filtered or unexported fields
}

PositionExpr is the expression for order by and group by position. MySQL use position expression started from 1, it looks a little confused inner. maybe later we will use 0 at first.

func (*PositionExpr) Accept

func (n *PositionExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PositionExpr) GetType

func (en *PositionExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*PositionExpr) Restore

func (n *PositionExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PositionExpr) SetType

func (en *PositionExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type PrepareStmt

type PrepareStmt struct {
	Name    string
	SQLText string
	SQLVar  *VariableExpr
	// contains filtered or unexported fields
}

PrepareStmt is a statement to prepares a SQL statement which contains placeholders, and it is executed with ExecuteStmt and released with DeallocateStmt. See https://dev.mysql.com/doc/refman/5.7/en/prepare.html

func (*PrepareStmt) Accept

func (n *PrepareStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PrepareStmt) Restore

func (n *PrepareStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type PrivElem

type PrivElem struct {
	Priv mysql.PrivilegeType
	Cols []*ColumnName
	Name string
	// contains filtered or unexported fields
}

PrivElem is the privilege type and optional column list.

func (*PrivElem) Accept

func (n *PrivElem) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PrivElem) OriginTextPosition

func (n *PrivElem) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*PrivElem) OriginalText

func (n *PrivElem) OriginalText() string

OriginalText implements Node interface.

func (*PrivElem) Restore

func (n *PrivElem) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*PrivElem) SetNoBackslashEscapes

func (n *PrivElem) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*PrivElem) SetOriginTextPosition

func (n *PrivElem) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*PrivElem) SetText

func (n *PrivElem) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*PrivElem) Text

func (n *PrivElem) Text() string

Text implements Node interface.

type ProcCaseStmt

type ProcCaseStmt struct {
	Expr        ExprNode // nil for the searched CASE form
	WhenClauses []*ProcWhenClause
	Else        []StmtNode
	// contains filtered or unexported fields
}

ProcCaseStmt is a CASE ... END CASE statement in a compound body.

func (*ProcCaseStmt) Accept

func (n *ProcCaseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ProcCaseStmt) Restore

func (n *ProcCaseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ProcIfBranch

type ProcIfBranch struct {
	Cond  ExprNode
	Stmts []StmtNode
}

ProcIfBranch is one IF/ELSEIF branch of a procedure IF statement.

type ProcIfStmt

type ProcIfStmt struct {
	Branches []*ProcIfBranch
	Else     []StmtNode
	// contains filtered or unexported fields
}

ProcIfStmt is an IF ... END IF statement in a compound body.

func (*ProcIfStmt) Accept

func (n *ProcIfStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ProcIfStmt) Restore

func (n *ProcIfStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ProcWhenClause

type ProcWhenClause struct {
	Expr  ExprNode
	Stmts []StmtNode
}

ProcWhenClause is one WHEN arm of a procedure CASE statement.

type PurgeLogsStmt

type PurgeLogsStmt struct {

	// To is the target log file name; empty when Before is set.
	To string
	// Before is the cutoff datetime expression; nil when To is set.
	Before ExprNode
	// contains filtered or unexported fields
}

PurgeLogsStmt is a PURGE BINARY LOGS statement. The deprecated MASTER spelling parses too and restores as BINARY. See https://dev.mysql.com/doc/refman/8.0/en/purge-binary-logs.html

func (*PurgeLogsStmt) Accept

func (n *PurgeLogsStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*PurgeLogsStmt) Restore

func (n *PurgeLogsStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RedoLogAction

type RedoLogAction int

RedoLogAction is the {ENABLE | DISABLE} INNODB REDO_LOG action of ALTER INSTANCE.

const (
	RedoLogActionNone RedoLogAction = iota
	RedoLogActionEnable
	RedoLogActionDisable
)

RedoLogAction values.

type ReferOptionType

type ReferOptionType int

ReferOptionType is the type for refer options.

const (
	ReferOptionNoOption ReferOptionType = iota
	ReferOptionRestrict
	ReferOptionCascade
	ReferOptionSetNull
	ReferOptionNoAction
	ReferOptionSetDefault
)

Refer option types.

func (ReferOptionType) String

func (r ReferOptionType) String() string

String implements fmt.Stringer interface.

type ReferenceDef

type ReferenceDef struct {
	Table                   *TableName
	IndexPartSpecifications []*IndexPartSpecification
	OnDelete                *OnDeleteOpt
	OnUpdate                *OnUpdateOpt
	Match                   MatchType
	// contains filtered or unexported fields
}

ReferenceDef is used for parsing foreign key reference option from SQL. See http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html

func (*ReferenceDef) Accept

func (n *ReferenceDef) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ReferenceDef) OriginTextPosition

func (n *ReferenceDef) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*ReferenceDef) OriginalText

func (n *ReferenceDef) OriginalText() string

OriginalText implements Node interface.

func (*ReferenceDef) Restore

func (n *ReferenceDef) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ReferenceDef) SetNoBackslashEscapes

func (n *ReferenceDef) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*ReferenceDef) SetOriginTextPosition

func (n *ReferenceDef) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*ReferenceDef) SetText

func (n *ReferenceDef) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*ReferenceDef) Text

func (n *ReferenceDef) Text() string

Text implements Node interface.

type ReleaseSavepointStmt

type ReleaseSavepointStmt struct {

	// Name is the savepoint name.
	Name string
	// contains filtered or unexported fields
}

ReleaseSavepointStmt is the statement of RELEASE SAVEPOINT.

func (*ReleaseSavepointStmt) Accept

func (n *ReleaseSavepointStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ReleaseSavepointStmt) Restore

func (n *ReleaseSavepointStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RenameTableStmt

type RenameTableStmt struct {
	TableToTables []*TableToTable
	// contains filtered or unexported fields
}

RenameTableStmt is a statement to rename a table. See http://dev.mysql.com/doc/refman/5.7/en/rename-table.html

func (*RenameTableStmt) Accept

func (n *RenameTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RenameTableStmt) Restore

func (n *RenameTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RenameUserStmt

type RenameUserStmt struct {
	UserToUsers []*UserToUser
	// contains filtered or unexported fields
}

RenameUserStmt is a statement to rename a user. See http://dev.mysql.com/doc/refman/5.7/en/rename-user.html

func (*RenameUserStmt) Accept

func (n *RenameUserStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RenameUserStmt) Restore

func (n *RenameUserStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RepairTableStmt

type RepairTableStmt struct {
	NoWriteToBinLog bool
	Tables          []*TableName
	Quick           bool
	Extended        bool
	UseFrm          bool
	// contains filtered or unexported fields
}

RepairTableStmt is a statement to repair tables. See https://dev.mysql.com/doc/refman/8.4/en/repair-table.html

func (*RepairTableStmt) Accept

func (n *RepairTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RepairTableStmt) Restore

func (n *RepairTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RepeatStmt

type RepeatStmt struct {
	Label       CIStr
	HasEndLabel bool
	Stmts       []StmtNode
	Until       ExprNode
	// contains filtered or unexported fields
}

RepeatStmt is a REPEAT ... UNTIL ... END REPEAT loop in a compound body.

func (*RepeatStmt) Accept

func (n *RepeatStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RepeatStmt) Restore

func (n *RepeatStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ReplicationListItem

type ReplicationListItem struct {
	Table *TableName
	Str   string
	IsStr bool
	Num   uint64
	IsNum bool
	// PairFrom/PairTo hold a REPLICATE_REWRITE_DB ((from, to)) pair.
	PairFrom CIStr
	PairTo   CIStr
	IsPair   bool
}

ReplicationListItem is one entry of a parenthesized replication option value, e.g. a database in REPLICATE_DO_DB, a table in REPLICATE_DO_TABLE, a server id in IGNORE_SERVER_IDS, or a rename pair in REPLICATE_REWRITE_DB. Exactly one field group is set.

type ReplicationOption

type ReplicationOption struct {
	Name string
	// Value is a literal value (string, number or NULL).
	Value ExprNode
	// IdentValue is a bare word value such as LOCAL or OFF.
	IdentValue CIStr
	// UserValue is a user@host value (PRIVILEGE_CHECKS_USER).
	UserValue *auth.UserIdentity
	// List is a parenthesized value list; HasList distinguishes an
	// empty list from no value.
	List    []*ReplicationListItem
	HasList bool
}

ReplicationOption is one name/value pair of a replication statement option list. At most one value field is set; none for bare options such as SQL_AFTER_MTS_GAPS.

type ResetBinaryLogsStmt

type ResetBinaryLogsStmt struct {

	// To is the optional binary log index number to start from.
	To    uint64
	HasTo bool
	// contains filtered or unexported fields
}

ResetBinaryLogsStmt is a RESET BINARY LOGS AND GTIDS statement. The deprecated RESET MASTER spelling parses to the same node.

func (*ResetBinaryLogsStmt) Accept

func (n *ResetBinaryLogsStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ResetBinaryLogsStmt) Restore

func (n *ResetBinaryLogsStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ResetPersistStmt

type ResetPersistStmt struct {
	IfExists bool
	// Variable is empty when resetting all persisted variables.
	Variable string
	// contains filtered or unexported fields
}

ResetPersistStmt is a RESET PERSIST statement.

func (*ResetPersistStmt) Accept

func (n *ResetPersistStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ResetPersistStmt) Restore

func (n *ResetPersistStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ResetReplicaStmt

type ResetReplicaStmt struct {
	All        bool
	Channel    string
	HasChannel bool
	// contains filtered or unexported fields
}

ResetReplicaStmt is a RESET REPLICA (or deprecated RESET SLAVE) statement.

func (*ResetReplicaStmt) Accept

func (n *ResetReplicaStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ResetReplicaStmt) Restore

func (n *ResetReplicaStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ResignalStmt

type ResignalStmt struct {
	Condition *SignalCondition // nil for the bare RESIGNAL form
	Items     []*SignalItem
	// contains filtered or unexported fields
}

ResignalStmt is a RESIGNAL statement. See https://dev.mysql.com/doc/refman/8.4/en/resignal.html

func (*ResignalStmt) Accept

func (n *ResignalStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ResignalStmt) Restore

func (n *ResignalStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ResourceGroupNameOption

type ResourceGroupNameOption struct {
	Value string
}

func (*ResourceGroupNameOption) Restore

type ResourceOption

type ResourceOption struct {
	Type  int
	Count int64
}

func (*ResourceOption) Restore

func (r *ResourceOption) Restore(ctx *format.RestoreCtx) error

type RestartStmt

type RestartStmt struct {
	// contains filtered or unexported fields
}

RestartStmt is a statement to restart the server (MySQL 8.0 RESTART). See https://dev.mysql.com/doc/refman/8.0/en/restart.html

func (*RestartStmt) Accept

func (n *RestartStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RestartStmt) Restore

func (n *RestartStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ResultSetNode

type ResultSetNode interface {
	Node
	// contains filtered or unexported methods
}

ResultSetNode interface has a ResultFields property, represents a Node that returns result set. Implementations include SelectStmt, SubqueryExpr, TableSource, TableName, Join and SetOprStmt.

type ReturnStmt

type ReturnStmt struct {
	Expr ExprNode
	// contains filtered or unexported fields
}

ReturnStmt is a RETURN statement in a stored function body.

func (*ReturnStmt) Accept

func (n *ReturnStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ReturnStmt) Restore

func (n *ReturnStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RevokeProxyStmt

type RevokeProxyStmt struct {
	IfExists      bool
	LocalUser     *auth.UserIdentity
	ExternalUsers []*auth.UserIdentity
	// IgnoreUnknownUser is the trailing IGNORE UNKNOWN USER clause (MySQL 8.0.30+).
	IgnoreUnknownUser bool
	// contains filtered or unexported fields
}

RevokeProxyStmt is the struct for REVOKE [IF EXISTS] PROXY ON user FROM users.

func (*RevokeProxyStmt) Accept

func (n *RevokeProxyStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RevokeProxyStmt) Restore

func (n *RevokeProxyStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RevokeRoleStmt

type RevokeRoleStmt struct {
	IfExists bool
	Roles    []*auth.RoleIdentity
	Users    []*auth.UserIdentity
	// IgnoreUnknownUser is the trailing IGNORE UNKNOWN USER clause (MySQL 8.0.30+).
	IgnoreUnknownUser bool
	// contains filtered or unexported fields
}

RevokeRoleStmt is the struct for REVOKE <roles> FROM <users>.

func (*RevokeRoleStmt) Accept

func (n *RevokeRoleStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RevokeRoleStmt) Restore

func (n *RevokeRoleStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RevokeStmt

type RevokeStmt struct {
	IfExists   bool
	Privs      []*PrivElem
	ObjectType ObjectTypeType
	Level      *GrantLevel
	Users      []*UserSpec
	// IgnoreUnknownUser is the trailing IGNORE UNKNOWN USER clause (MySQL 8.0.30+).
	IgnoreUnknownUser bool
	// contains filtered or unexported fields
}

RevokeStmt is the struct for REVOKE statement.

func (*RevokeStmt) Accept

func (n *RevokeStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RevokeStmt) Restore

func (n *RevokeStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RoleOrPriv

type RoleOrPriv struct {
	Symbols string // hold undecided symbols
	Node    any    // hold auth.RoleIdentity or PrivElem that can be sure when parsing
}

RoleOrPriv is a temporary structure to be further processed into auth.RoleIdentity or PrivElem

func (*RoleOrPriv) ToPriv

func (n *RoleOrPriv) ToPriv() (*PrivElem, error)

func (*RoleOrPriv) ToRole

func (n *RoleOrPriv) ToRole() (*auth.RoleIdentity, error)

type RollbackStmt

type RollbackStmt struct {

	// CompletionType overwrites system variable `completion_type` within transaction
	CompletionType CompletionType
	// SavepointName is the savepoint name.
	SavepointName string
	// contains filtered or unexported fields
}

RollbackStmt is a statement to roll back the current transaction. See https://dev.mysql.com/doc/refman/5.7/en/commit.html

func (*RollbackStmt) Accept

func (n *RollbackStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RollbackStmt) Restore

func (n *RollbackStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RoutineLibrary

type RoutineLibrary struct {
	Name  *TableName
	Alias CIStr
}

RoutineLibrary is one library reference of a USING clause.

type RoutineOption

type RoutineOption struct {
	Tp        RoutineOptionType
	StrValue  string            // COMMENT text or LANGUAGE name
	Libraries []*RoutineLibrary // USING (...) entries
}

RoutineOption is one characteristic of a CREATE/ALTER routine statement. The parsed order is preserved so statements restore in their written form.

func (*RoutineOption) Restore

func (n *RoutineOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type RoutineOptionType

type RoutineOptionType int

RoutineOptionType is the kind of a routine characteristic.

const (
	RoutineOptionComment RoutineOptionType = iota
	RoutineOptionLanguageSQL
	RoutineOptionLanguage
	RoutineOptionDeterministic
	RoutineOptionNotDeterministic
	RoutineOptionContainsSQL
	RoutineOptionNoSQL
	RoutineOptionReadsSQLData
	RoutineOptionModifiesSQLData
	RoutineOptionSecurityDefiner
	RoutineOptionSecurityInvoker
	RoutineOptionUsing
	RoutineOptionDropComment
)

RoutineOptionType values.

type RoutineParam

type RoutineParam struct {
	Name      CIStr
	Direction RoutineParamDirection // procedures only; functions are always IN
	Type      *types.FieldType
}

RoutineParam is one parameter of a stored procedure or function.

func (*RoutineParam) Restore

func (n *RoutineParam) Restore(ctx *format.RestoreCtx, withDirection bool) error

Restore implements Node interface.

type RoutineParamDirection

type RoutineParamDirection int

RoutineParamDirection is the parameter mode of a stored procedure parameter.

const (
	RoutineParamIn RoutineParamDirection = iota
	RoutineParamOut
	RoutineParamInOut
)

RoutineParamDirection values.

type RoutineType

type RoutineType int

RoutineType is the object kind of a DROP routine statement.

const (
	RoutineTypeProcedure RoutineType = iota
	RoutineTypeFunction
	RoutineTypeTrigger
	RoutineTypeEvent
)

RoutineType values.

type RowExpr

type RowExpr struct {
	Values []ExprNode
	// contains filtered or unexported fields
}

RowExpr is the expression for row constructor. See https://dev.mysql.com/doc/refman/5.7/en/row-subqueries.html

func (*RowExpr) Accept

func (n *RowExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*RowExpr) GetType

func (en *RowExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*RowExpr) Restore

func (n *RowExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*RowExpr) SetType

func (en *RowExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type SRSAttribute

type SRSAttribute struct {
	Tp    SRSAttributeType
	Value string
	OrgID uint64 // ORGANIZATION ... IDENTIFIED BY
}

SRSAttribute is one attribute of CREATE SPATIAL REFERENCE SYSTEM.

func (*SRSAttribute) Restore

func (n *SRSAttribute) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SRSAttributeType

type SRSAttributeType int

SRSAttributeType is the attribute kind in CREATE SPATIAL REFERENCE SYSTEM.

const (
	SRSAttrName SRSAttributeType = iota
	SRSAttrDefinition
	SRSAttrOrganization
	SRSAttrDescription
)

SRS attribute types.

type SavepointStmt

type SavepointStmt struct {

	// Name is the savepoint name.
	Name string
	// contains filtered or unexported fields
}

SavepointStmt is the statement of SAVEPOINT.

func (*SavepointStmt) Accept

func (n *SavepointStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SavepointStmt) Restore

func (n *SavepointStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SelectField

type SelectField struct {

	// Offset is used to get original text.
	Offset int
	// WildCard is not nil, Expr will be nil.
	WildCard *WildCardField
	// Expr is not nil, WildCard will be nil.
	Expr ExprNode
	// AsName is alias name for Expr.
	AsName CIStr
	// Auxiliary stands for if this field is auxiliary.
	// When we add a Field into SelectField list which is used for having/orderby clause but the field is not in select clause,
	// we should set its Auxiliary to true. Then the TrimExec will trim the field.
	Auxiliary             bool
	AuxiliaryColInAgg     bool
	AuxiliaryColInOrderBy bool
	// contains filtered or unexported fields
}

SelectField represents fields in select statement. There are two type of select field: wildcard and expression with optional alias name.

func (*SelectField) Accept

func (n *SelectField) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SelectField) Match

func (n *SelectField) Match(col *ColumnNameExpr, ignoreAsName bool) bool

func (*SelectField) OriginTextPosition

func (n *SelectField) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*SelectField) OriginalText

func (n *SelectField) OriginalText() string

OriginalText implements Node interface.

func (*SelectField) Restore

func (n *SelectField) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*SelectField) SetNoBackslashEscapes

func (n *SelectField) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*SelectField) SetOriginTextPosition

func (n *SelectField) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*SelectField) SetText

func (n *SelectField) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*SelectField) Text

func (n *SelectField) Text() string

Text implements Node interface.

type SelectIntoOption

type SelectIntoOption struct {
	Tp       SelectIntoType
	FileName string
	// Charset is the optional CHARACTER SET clause of INTO OUTFILE.
	Charset    string
	FieldsInfo *FieldsClause
	LinesInfo  *LinesClause
	// Variables is the user variable list of SELECT ... INTO @var [, @var] ...
	Variables []ExprNode
	// contains filtered or unexported fields
}

func (*SelectIntoOption) Accept

func (n *SelectIntoOption) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SelectIntoOption) OriginTextPosition

func (n *SelectIntoOption) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*SelectIntoOption) OriginalText

func (n *SelectIntoOption) OriginalText() string

OriginalText implements Node interface.

func (*SelectIntoOption) Restore

func (n *SelectIntoOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*SelectIntoOption) SetNoBackslashEscapes

func (n *SelectIntoOption) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*SelectIntoOption) SetOriginTextPosition

func (n *SelectIntoOption) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*SelectIntoOption) SetText

func (n *SelectIntoOption) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*SelectIntoOption) Text

func (n *SelectIntoOption) Text() string

Text implements Node interface.

type SelectIntoType

type SelectIntoType int
const (
	SelectIntoOutfile SelectIntoType = iota + 1
	SelectIntoDumpfile
	SelectIntoVars
)

type SelectLockInfo

type SelectLockInfo struct {
	LockType SelectLockType
	WaitSec  uint64
	Tables   []*TableName
}

type SelectLockType

type SelectLockType int

SelectLockType is the lock type for SelectStmt.

const (
	SelectLockNone SelectLockType = iota
	SelectLockForUpdate
	SelectLockForShare
	SelectLockForUpdateNoWait
	SelectLockForUpdateWaitN
	SelectLockForShareNoWait
	SelectLockForUpdateSkipLocked
	SelectLockForShareSkipLocked
)

Select lock types.

func (SelectLockType) String

func (n SelectLockType) String() string

String implements fmt.Stringer.

type SelectStmt

type SelectStmt struct {

	// SelectStmtOpts wraps around select hints and switches.
	*SelectStmtOpts
	// Distinct represents whether the select has distinct option.
	Distinct bool
	// From is the from clause of the query.
	From *TableRefsClause
	// Where is the where clause in select statement.
	Where ExprNode
	// Fields is the select expression list.
	Fields *FieldList
	// GroupBy is the group by expression list.
	GroupBy *GroupByClause
	// Having is the having condition.
	Having *HavingClause
	// WindowSpecs is the window specification list.
	WindowSpecs []WindowSpec
	// Qualify is the QUALIFY window-filter condition (MySQL 9.7+).
	Qualify ExprNode
	// OrderBy is the ordering expression list.
	OrderBy *OrderByClause
	// Limit is the limit clause.
	Limit *Limit
	// LockInfos are the locking clauses (FOR UPDATE, FOR SHARE, LOCK IN SHARE
	// MODE); MySQL allows several locking clauses in one query block.
	LockInfos []*SelectLockInfo
	// TableHints represents the table level Optimizer Hint for join type
	TableHints []*TableOptimizerHint
	// IsInBraces indicates whether it's a stmt in brace.
	IsInBraces bool
	// WithBeforeBraces indicates whether stmt's with clause is before the brace.
	// It's used to distinguish (with xxx select xxx) and with xxx (select xxx)
	WithBeforeBraces bool
	// QueryBlockOffset indicates the order of this SelectStmt if counted from left to right in the sql text.
	QueryBlockOffset int
	// SelectIntoOpt is the select-into option.
	SelectIntoOpt *SelectIntoOption
	// AfterSetOperator indicates the SelectStmt after which type of set operator
	AfterSetOperator *SetOprType
	// Kind refer to three kind of statement: SelectStmt, TableStmt and ValuesStmt
	Kind SelectStmtKind
	// Lists is filled only when Kind == SelectStmtKindValues
	Lists []*RowExpr
	With  *WithClause
	// AsViewSchema indicates if this stmt provides the schema for the view. It is only used when creating the view
	AsViewSchema bool
	// contains filtered or unexported fields
}

SelectStmt represents the select query node. See https://dev.mysql.com/doc/refman/5.7/en/select.html

func (*SelectStmt) Accept

func (n *SelectStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SelectStmt) Restore

func (n *SelectStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SelectStmtKind

type SelectStmtKind uint8
const (
	SelectStmtKindSelect SelectStmtKind = iota
	SelectStmtKindTable
	SelectStmtKindValues
)

func (*SelectStmtKind) String

func (s *SelectStmtKind) String() string

type SelectStmtOpts

type SelectStmtOpts struct {
	Distinct        bool
	SQLBigResult    bool
	SQLBufferResult bool
	SQLCache        bool
	SQLSmallResult  bool
	CalcFoundRows   bool
	StraightJoin    bool
	Priority        mysql.PriorityEnum
	TableHints      []*TableOptimizerHint
	ExplicitAll     bool
}

SelectStmtOpts wrap around select hints and switches

type ServerOption

type ServerOption struct {
	Name string
	// StrValue is the quoted value; PORT takes a number instead.
	StrValue string
	NumValue uint64
	IsNum    bool
}

ServerOption is one name/value pair in a CREATE/ALTER SERVER OPTIONS list. MySQL fixes the option names (HOST, DATABASE, USER, PASSWORD, SOCKET, OWNER, PORT); the parser accepts any identifier and preserves it, leaving validation to the server.

type SetCollationExpr

type SetCollationExpr struct {

	// Expr is the expression to be set.
	Expr ExprNode
	// Collate is the name of collation to set.
	Collate string
	// contains filtered or unexported fields
}

SetCollationExpr is the expression for the `COLLATE collation_name` clause.

func (*SetCollationExpr) Accept

func (n *SetCollationExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetCollationExpr) GetType

func (en *SetCollationExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*SetCollationExpr) Restore

func (n *SetCollationExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*SetCollationExpr) SetType

func (en *SetCollationExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type SetDefaultRoleStmt

type SetDefaultRoleStmt struct {
	SetRoleOpt SetRoleStmtType
	RoleList   []*auth.RoleIdentity
	UserList   []*auth.UserIdentity
	// contains filtered or unexported fields
}

func (*SetDefaultRoleStmt) Accept

func (n *SetDefaultRoleStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetDefaultRoleStmt) Restore

func (n *SetDefaultRoleStmt) Restore(ctx *format.RestoreCtx) error

type SetOprSelectList

type SetOprSelectList struct {
	With             *WithClause
	AfterSetOperator *SetOprType
	Selects          []Node
	Limit            *Limit
	OrderBy          *OrderByClause
	// contains filtered or unexported fields
}

SetOprSelectList represents the SelectStmt/TableStmt/ValuesStmt list in a union statement.

func (*SetOprSelectList) Accept

func (n *SetOprSelectList) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetOprSelectList) OriginTextPosition

func (n *SetOprSelectList) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*SetOprSelectList) OriginalText

func (n *SetOprSelectList) OriginalText() string

OriginalText implements Node interface.

func (*SetOprSelectList) Restore

func (n *SetOprSelectList) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*SetOprSelectList) SetNoBackslashEscapes

func (n *SetOprSelectList) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*SetOprSelectList) SetOriginTextPosition

func (n *SetOprSelectList) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*SetOprSelectList) SetText

func (n *SetOprSelectList) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*SetOprSelectList) Text

func (n *SetOprSelectList) Text() string

Text implements Node interface.

type SetOprStmt

type SetOprStmt struct {
	IsInBraces bool
	SelectList *SetOprSelectList
	OrderBy    *OrderByClause
	Limit      *Limit
	With       *WithClause
	// IntoOpt is the trailing INTO of a parenthesized query expression:
	// (SELECT ...) [ORDER BY ...] [LIMIT ...] INTO var_list.
	IntoOpt *SelectIntoOption
	// contains filtered or unexported fields
}

SetOprStmt represents "union/except/intersect statement" See https://dev.mysql.com/doc/refman/5.7/en/union.html INTERSECT and EXCEPT are supported by MySQL 8.0.31+. See https://dev.mysql.com/doc/refman/8.0/en/set-operations.html

func (*SetOprStmt) Accept

func (n *SetOprStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetOprStmt) Restore

func (n *SetOprStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SetOprType

type SetOprType uint8
const (
	Union SetOprType = iota
	UnionAll
	Except
	ExceptAll
	Intersect
	IntersectAll
)

func (*SetOprType) String

func (s *SetOprType) String() string

type SetPwdStmt

type SetPwdStmt struct {
	User                  *auth.UserIdentity
	Password              string
	RetainCurrentPassword bool
	// Random is the SET PASSWORD ... TO RANDOM form (MySQL 8.0.18+).
	Random bool
	// HasReplace / ReplaceString carry REPLACE 'current password'
	// (MySQL 8.0.14+ password verification).
	HasReplace    bool
	ReplaceString string
	// contains filtered or unexported fields
}

SetPwdStmt is a statement to assign a password to user account. See https://dev.mysql.com/doc/refman/5.7/en/set-password.html

func (*SetPwdStmt) Accept

func (n *SetPwdStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetPwdStmt) Restore

func (n *SetPwdStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SetResourceGroupStmt

type SetResourceGroupStmt struct {
	Name    CIStr
	Threads []uint64
	// contains filtered or unexported fields
}

SetResourceGroupStmt is a SET RESOURCE GROUP statement.

func (*SetResourceGroupStmt) Accept

func (n *SetResourceGroupStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetResourceGroupStmt) Restore

func (n *SetResourceGroupStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SetRoleStmt

type SetRoleStmt struct {
	SetRoleOpt SetRoleStmtType
	RoleList   []*auth.RoleIdentity
	// contains filtered or unexported fields
}

func (*SetRoleStmt) Accept

func (n *SetRoleStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetRoleStmt) Restore

func (n *SetRoleStmt) Restore(ctx *format.RestoreCtx) error

type SetRoleStmtType

type SetRoleStmtType int

SetRoleStmtType is the type for FLUSH statement.

const (
	SetRoleDefault SetRoleStmtType = iota
	SetRoleNone
	SetRoleAll
	SetRoleAllExcept
	SetRoleRegular
)

SetRole statement types.

type SetStmt

type SetStmt struct {

	// Variables is the list of variable assignment.
	Variables []*VariableAssignment
	// contains filtered or unexported fields
}

SetStmt is the statement to set variables.

func (*SetStmt) Accept

func (n *SetStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SetStmt) Restore

func (n *SetStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ShowStmt

type ShowStmt struct {
	Tp          ShowStmtType // Databases/Tables/Columns/....
	DBName      string
	EngineName  string      // Used for SHOW ENGINE <engine> {STATUS|LOGS|MUTEX}.
	Table       *TableName  // Used for showing columns.
	Partition   CIStr       // Used for showing partition.
	Column      *ColumnName // Used for `desc table column`.
	IndexName   CIStr
	Flag        int // Some flag parsed from sql, such as FULL.
	Full        bool
	User        *auth.UserIdentity   // Used for show grants/create user.
	Roles       []*auth.RoleIdentity // Used for show grants .. using
	IfNotExists bool                 // Used for `show create database if not exists`
	Extended    bool                 // Used for `show extended columns from ...`
	Limit       *Limit               // Used for partial Show STMTs to limit Result Set row numbers.

	CountWarningsOrErrors bool // Used for showing count(*) warnings | errors

	// GlobalScope is used by `show variables`
	GlobalScope bool
	Pattern     *PatternLikeExpr
	Where       ExprNode

	ShowProfileTypes []int  // Used for `SHOW PROFILE` syntax
	ShowProfileArgs  *int64 // Used for `SHOW PROFILE` syntax
	ShowProfileLimit *Limit // Used for `SHOW PROFILE` syntax

	LogName    string // Used for `SHOW BINLOG EVENTS IN 'name'`
	Pos        uint64 // Used for `SHOW BINLOG EVENTS ... FROM pos`
	HasPos     bool
	Channel    string // Used for `SHOW REPLICA STATUS FOR CHANNEL 'name'`
	HasChannel bool
	// ParseTreeStmt is the statement whose parse tree is requested by
	// `SHOW PARSE_TREE <stmt>` (available in debug builds of MySQL).
	ParseTreeStmt StmtNode
	// contains filtered or unexported fields
}

ShowStmt is a statement to provide information about databases, tables, columns and so on. See https://dev.mysql.com/doc/refman/5.7/en/show.html

func (*ShowStmt) Accept

func (n *ShowStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ShowStmt) Restore

func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type ShowStmtType

type ShowStmtType int

ShowStmtType is the type for SHOW statement.

type ShutdownStmt

type ShutdownStmt struct {
	// contains filtered or unexported fields
}

ShutdownStmt is a statement to stop the MySQL server. See https://dev.mysql.com/doc/refman/8.0/en/shutdown.html

func (*ShutdownStmt) Accept

func (n *ShutdownStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ShutdownStmt) Restore

func (n *ShutdownStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SignalCondition

type SignalCondition struct {
	IsSQLState bool
	State      string
	Name       CIStr
}

SignalCondition is the condition value of a SIGNAL/RESIGNAL statement.

func (*SignalCondition) Restore

func (n *SignalCondition) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SignalItem

type SignalItem struct {
	Name  string // condition information item name, e.g. MESSAGE_TEXT
	Value ExprNode
}

SignalItem is one name = value entry of a SIGNAL/RESIGNAL SET clause.

type SignalStmt

type SignalStmt struct {
	Condition *SignalCondition
	Items     []*SignalItem
	// contains filtered or unexported fields
}

SignalStmt is a SIGNAL statement. See https://dev.mysql.com/doc/refman/8.4/en/signal.html

func (*SignalStmt) Accept

func (n *SignalStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SignalStmt) Restore

func (n *SignalStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type StartGroupReplicationStmt

type StartGroupReplicationStmt struct {
	Options []*ReplicationOption
	// contains filtered or unexported fields
}

StartGroupReplicationStmt is a START GROUP_REPLICATION statement.

func (*StartGroupReplicationStmt) Accept

func (n *StartGroupReplicationStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*StartGroupReplicationStmt) Restore

Restore implements Node interface.

type StartReplicaStmt

type StartReplicaStmt struct {

	// Threads holds IO_THREAD/SQL_THREAD in statement order.
	Threads []string
	Until   []*ReplicationOption
	// Options are the space-separated connection options (USER,
	// PASSWORD, DEFAULT_AUTH, PLUGIN_DIR).
	Options    []*ReplicationOption
	Channel    string
	HasChannel bool
	// contains filtered or unexported fields
}

StartReplicaStmt is a START REPLICA (or deprecated START SLAVE) statement. See https://dev.mysql.com/doc/refman/8.0/en/start-replica.html

func (*StartReplicaStmt) Accept

func (n *StartReplicaStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*StartReplicaStmt) Restore

func (n *StartReplicaStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type StatsOptionType

type StatsOptionType int
const (
	StatsOptionBuckets StatsOptionType = 0x5000 + iota
	StatsOptionTopN
	StatsOptionColsChoice
	StatsOptionColList
	StatsOptionSampleRate
)

type StmtNode

type StmtNode interface {
	Node
	// contains filtered or unexported methods
}

StmtNode represents statement node. Name of implementations should have 'Stmt' suffix.

type StopGroupReplicationStmt

type StopGroupReplicationStmt struct {
	// contains filtered or unexported fields
}

StopGroupReplicationStmt is a STOP GROUP_REPLICATION statement.

func (*StopGroupReplicationStmt) Accept

func (n *StopGroupReplicationStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*StopGroupReplicationStmt) Restore

Restore implements Node interface.

type StopReplicaStmt

type StopReplicaStmt struct {
	Threads    []string
	Channel    string
	HasChannel bool
	// contains filtered or unexported fields
}

StopReplicaStmt is a STOP REPLICA (or deprecated STOP SLAVE) statement.

func (*StopReplicaStmt) Accept

func (n *StopReplicaStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*StopReplicaStmt) Restore

func (n *StopReplicaStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type SubPartitionDefinition

type SubPartitionDefinition struct {
	Name    CIStr
	Options []*TableOption
}

func (*SubPartitionDefinition) Restore

func (spd *SubPartitionDefinition) Restore(ctx *format.RestoreCtx) error

type SubqueryExpr

type SubqueryExpr struct {

	// Query is the query SelectNode.
	Query      ResultSetNode
	Evaluated  bool
	Correlated bool
	MultiRows  bool
	Exists     bool
	// contains filtered or unexported fields
}

SubqueryExpr represents a subquery.

func (*SubqueryExpr) Accept

func (n *SubqueryExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*SubqueryExpr) GetType

func (en *SubqueryExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*SubqueryExpr) Restore

func (n *SubqueryExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*SubqueryExpr) SetType

func (en *SubqueryExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type TableLock

type TableLock struct {
	Table *TableName
	// Alias is the optional [AS] alias of the locked table.
	Alias CIStr
	Type  TableLockType
}

TableLock contains the table name and lock type.

type TableLockType

type TableLockType byte

TableLockType is the type of the table lock.

const (
	// TableLockNone means this table lock is absent.
	TableLockNone TableLockType = iota
	// TableLockRead means the session with this lock can read the table (but not write it).
	// Multiple sessions can acquire a READ lock for the table at the same time.
	// Other sessions can read the table without explicitly acquiring a READ lock.
	TableLockRead
	// TableLockReadLocal is not supported.
	TableLockReadLocal
	// TableLockReadOnly is used to set a table into read-only status,
	// when the session exits, it will not release its lock automatically.
	TableLockReadOnly
	// TableLockWrite means only the session with this lock has write/read permission.
	// Only the session that holds the lock can access the table. No other session can access it until the lock is released.
	TableLockWrite
	// TableLockWriteLocal means the session with this lock has write/read permission, and the other session still has read permission.
	TableLockWriteLocal
	// TableLockLowPriorityWrite is the deprecated LOW_PRIORITY WRITE type;
	// MySQL still parses it but treats it as WRITE.
	TableLockLowPriorityWrite
)

func (TableLockType) String

func (t TableLockType) String() string

String implements fmt.Stringer interface.

type TableName

type TableName struct {
	Schema CIStr
	Name   CIStr

	IndexHints     []*IndexHint
	PartitionNames []CIStr
	// IsAlias is true if this table name is an alias.
	//  sometime, we need to distinguish the table name is an alias or not.
	//   for example “`delete tt1 from t1 tt1,(select max(id) id from t2)tt2 where tt1.id<=tt2.id“`
	//   “`tt1“` is a alias name. so we need to set IsAlias to true and restore the table name without database name.
	IsAlias bool
	// contains filtered or unexported fields
}

TableName represents a table name.

func (*TableName) Accept

func (n *TableName) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableName) OriginTextPosition

func (n *TableName) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableName) OriginalText

func (n *TableName) OriginalText() string

OriginalText implements Node interface.

func (*TableName) Restore

func (n *TableName) Restore(ctx *format.RestoreCtx) error

func (*TableName) SetNoBackslashEscapes

func (n *TableName) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableName) SetOriginTextPosition

func (n *TableName) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableName) SetText

func (n *TableName) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableName) Text

func (n *TableName) Text() string

Text implements Node interface.

type TableOptimizerHint

type TableOptimizerHint struct {

	// HintName is the name or alias of the table(s) which the hint will affect.
	// Table hints has no schema info
	// It allows only table name or alias (if table has an alias)
	HintName CIStr
	// HintData is the payload of the hint. The actual type of this field
	// depends on `HintName`:
	//
	// - MAX_EXECUTION_TIME  => uint64
	// - RESOURCE_GROUP      => string
	// - SET_VAR             => HintSetVar
	HintData any
	// QBName is the default effective query block of this hint.
	QBName  CIStr
	Tables  []HintTable
	Indexes []CIStr
	// contains filtered or unexported fields
}

TableOptimizerHint is Table level optimizer hint

func (*TableOptimizerHint) Accept

func (n *TableOptimizerHint) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableOptimizerHint) OriginTextPosition

func (n *TableOptimizerHint) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableOptimizerHint) OriginalText

func (n *TableOptimizerHint) OriginalText() string

OriginalText implements Node interface.

func (*TableOptimizerHint) Restore

func (n *TableOptimizerHint) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TableOptimizerHint) SetNoBackslashEscapes

func (n *TableOptimizerHint) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableOptimizerHint) SetOriginTextPosition

func (n *TableOptimizerHint) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableOptimizerHint) SetText

func (n *TableOptimizerHint) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableOptimizerHint) Text

func (n *TableOptimizerHint) Text() string

Text implements Node interface.

type TableOption

type TableOption struct {
	Tp            TableOptionType
	Default       bool
	StrValue      string
	UintValue     uint64
	BoolValue     bool
	TimeUnitValue *TimeUnitExpr
	Value         *ValueExpr
	TableNames    []*TableName
	ColumnName    *ColumnName
	// contains filtered or unexported fields
}

TableOption is used for parsing table option from SQL.

func (*TableOption) Accept

func (n *TableOption) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableOption) OriginTextPosition

func (n *TableOption) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableOption) OriginalText

func (n *TableOption) OriginalText() string

OriginalText implements Node interface.

func (*TableOption) Restore

func (n *TableOption) Restore(ctx *format.RestoreCtx) error

func (*TableOption) SetNoBackslashEscapes

func (n *TableOption) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableOption) SetOriginTextPosition

func (n *TableOption) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableOption) SetText

func (n *TableOption) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableOption) Text

func (n *TableOption) Text() string

Text implements Node interface.

type TableOptionType

type TableOptionType int

TableOptionType is the type for TableOption

const (
	TableOptionNone TableOptionType = iota
	TableOptionEngine
	TableOptionCharset
	TableOptionCollate
	TableOptionAutoIdCache //nolint:revive
	TableOptionAutoIncrement
	TableOptionComment
	TableOptionAvgRowLength
	TableOptionCheckSum
	TableOptionCompression
	TableOptionConnection
	TableOptionPassword
	TableOptionKeyBlockSize
	TableOptionMaxRows
	TableOptionMinRows
	TableOptionDelayKeyWrite
	TableOptionRowFormat
	TableOptionStatsPersistent
	TableOptionStatsAutoRecalc
	TableOptionPackKeys
	TableOptionTablespace
	TableOptionNodegroup
	TableOptionDataDirectory
	TableOptionIndexDirectory
	TableOptionStorageMedia
	TableOptionStatsSamplePages
	TableOptionSecondaryEngine
	TableOptionSecondaryEngineNull
	TableOptionInsertMethod
	TableOptionUnion
	TableOptionEncryption
	TableOptionEngineAttribute
	TableOptionSecondaryEngineAttribute
	TableOptionAutoextendSize
)

TableOption types.

type TableRefsClause

type TableRefsClause struct {
	TableRefs *Join
	// contains filtered or unexported fields
}

TableRefsClause represents table references clause in dml statement.

func (*TableRefsClause) Accept

func (n *TableRefsClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableRefsClause) OriginTextPosition

func (n *TableRefsClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableRefsClause) OriginalText

func (n *TableRefsClause) OriginalText() string

OriginalText implements Node interface.

func (*TableRefsClause) Restore

func (n *TableRefsClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TableRefsClause) SetNoBackslashEscapes

func (n *TableRefsClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableRefsClause) SetOriginTextPosition

func (n *TableRefsClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableRefsClause) SetText

func (n *TableRefsClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableRefsClause) Text

func (n *TableRefsClause) Text() string

Text implements Node interface.

type TableSource

type TableSource struct {

	// Source is the source of the data, can be a TableName,
	// a SelectStmt, a SetOprStmt, or a JoinNode.
	Source ResultSetNode

	// AsName is the alias name of the table source.
	AsName CIStr

	// Lateral indicates whether this is a LATERAL derived table.
	// MySQL 8.0+ syntax: FROM t1, LATERAL (SELECT ...) AS dt
	// LATERAL allows the derived table to reference columns from tables to its left.
	Lateral bool

	// ColumnNames is the optional column alias list for derived tables.
	// e.g. LATERAL (SELECT ...) AS dt(c1, c2)
	ColumnNames []CIStr
	// contains filtered or unexported fields
}

TableSource represents table source with a name.

func (*TableSource) Accept

func (n *TableSource) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableSource) OriginTextPosition

func (n *TableSource) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableSource) OriginalText

func (n *TableSource) OriginalText() string

OriginalText implements Node interface.

func (*TableSource) Restore

func (n *TableSource) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TableSource) SetNoBackslashEscapes

func (n *TableSource) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableSource) SetOriginTextPosition

func (n *TableSource) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableSource) SetText

func (n *TableSource) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableSource) Text

func (n *TableSource) Text() string

Text implements Node interface.

type TableToTable

type TableToTable struct {
	OldTable *TableName
	NewTable *TableName
	// contains filtered or unexported fields
}

TableToTable represents renaming old table to new table used in RenameTableStmt.

func (*TableToTable) Accept

func (n *TableToTable) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TableToTable) OriginTextPosition

func (n *TableToTable) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableToTable) OriginalText

func (n *TableToTable) OriginalText() string

OriginalText implements Node interface.

func (*TableToTable) Restore

func (n *TableToTable) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TableToTable) SetNoBackslashEscapes

func (n *TableToTable) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*TableToTable) SetOriginTextPosition

func (n *TableToTable) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableToTable) SetText

func (n *TableToTable) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*TableToTable) Text

func (n *TableToTable) Text() string

Text implements Node interface.

type TablespaceOption

type TablespaceOption struct {
	Tp        TablespaceOptionType
	StrValue  string
	UintValue uint64
}

TablespaceOption is a single tablespace / logfile group option. Size options keep either a raw numeric value (UintValue) or the identifier spelling like "10M" (StrValue), matching how they were written.

func (*TablespaceOption) Restore

func (n *TablespaceOption) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type TablespaceOptionType

type TablespaceOptionType int

TablespaceOptionType is the type of a tablespace / logfile group option.

const (
	TablespaceOptNone TablespaceOptionType = iota
	TablespaceOptInitialSize
	TablespaceOptMaxSize
	TablespaceOptExtentSize
	TablespaceOptAutoextendSize
	TablespaceOptFileBlockSize
	TablespaceOptUndoBufferSize
	TablespaceOptRedoBufferSize
	TablespaceOptNodegroup
	TablespaceOptWait
	TablespaceOptNoWait
	TablespaceOptComment
	TablespaceOptEncryption
	TablespaceOptEngine
	TablespaceOptEngineAttribute
)

Tablespace option types.

type TemporaryKeyword

type TemporaryKeyword int
const (
	TemporaryNone TemporaryKeyword = iota
	TemporaryGlobal
	TemporaryLocal
)

type TextString

type TextString struct {
	Value           string
	IsBinaryLiteral bool
}

TextString represent a string, it can be a binary literal.

type TimeUnitExpr

type TimeUnitExpr struct {

	// Unit is the time or timestamp unit.
	Unit TimeUnitType
	// contains filtered or unexported fields
}

TimeUnitExpr is an expression representing a time or timestamp unit.

func (*TimeUnitExpr) Accept

func (n *TimeUnitExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TimeUnitExpr) GetType

func (en *TimeUnitExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*TimeUnitExpr) Restore

func (n *TimeUnitExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TimeUnitExpr) SetType

func (en *TimeUnitExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type TimeUnitType

type TimeUnitType int

TimeUnitType is the type for time and timestamp units.

const (
	// TimeUnitInvalid is a placeholder for an invalid time or timestamp unit
	TimeUnitInvalid TimeUnitType = iota
	// TimeUnitMicrosecond is the time or timestamp unit MICROSECOND.
	TimeUnitMicrosecond
	// TimeUnitSecond is the time or timestamp unit SECOND.
	TimeUnitSecond
	// TimeUnitMinute is the time or timestamp unit MINUTE.
	TimeUnitMinute
	// TimeUnitHour is the time or timestamp unit HOUR.
	TimeUnitHour
	// TimeUnitDay is the time or timestamp unit DAY.
	TimeUnitDay
	// TimeUnitWeek is the time or timestamp unit WEEK.
	TimeUnitWeek
	// TimeUnitMonth is the time or timestamp unit MONTH.
	TimeUnitMonth
	// TimeUnitQuarter is the time or timestamp unit QUARTER.
	TimeUnitQuarter
	// TimeUnitYear is the time or timestamp unit YEAR.
	TimeUnitYear
	// TimeUnitSecondMicrosecond is the time unit SECOND_MICROSECOND.
	TimeUnitSecondMicrosecond
	// TimeUnitMinuteMicrosecond is the time unit MINUTE_MICROSECOND.
	TimeUnitMinuteMicrosecond
	// TimeUnitMinuteSecond is the time unit MINUTE_SECOND.
	TimeUnitMinuteSecond
	// TimeUnitHourMicrosecond is the time unit HOUR_MICROSECOND.
	TimeUnitHourMicrosecond
	// TimeUnitHourSecond is the time unit HOUR_SECOND.
	TimeUnitHourSecond
	// TimeUnitHourMinute is the time unit HOUR_MINUTE.
	TimeUnitHourMinute
	// TimeUnitDayMicrosecond is the time unit DAY_MICROSECOND.
	TimeUnitDayMicrosecond
	// TimeUnitDaySecond is the time unit DAY_SECOND.
	TimeUnitDaySecond
	// TimeUnitDayMinute is the time unit DAY_MINUTE.
	TimeUnitDayMinute
	// TimeUnitDayHour is the time unit DAY_HOUR.
	TimeUnitDayHour
	// TimeUnitYearMonth is the time unit YEAR_MONTH.
	TimeUnitYearMonth
)

func (TimeUnitType) Duration

func (unit TimeUnitType) Duration() (time.Duration, error)

Duration represented by this unit. Returns error if the time unit is not a fixed time interval (such as MONTH) or a composite unit (such as MINUTE_SECOND).

func (TimeUnitType) String

func (unit TimeUnitType) String() string

String implements fmt.Stringer interface.

type TriggerEvent

type TriggerEvent int

TriggerEvent is the row operation a trigger fires on.

const (
	TriggerEventInsert TriggerEvent = iota
	TriggerEventUpdate
	TriggerEventDelete
)

TriggerEvent values.

type TriggerOrder

type TriggerOrder int

TriggerOrder is the FOLLOWS/PRECEDES placement of a trigger.

const (
	TriggerOrderNone TriggerOrder = iota
	TriggerOrderFollows
	TriggerOrderPrecedes
)

TriggerOrder values.

type TriggerTime

type TriggerTime int

TriggerTime is when a trigger fires relative to the row operation.

const (
	TriggerTimeBefore TriggerTime = iota
	TriggerTimeAfter
)

TriggerTime values.

type TrimDirectionExpr

type TrimDirectionExpr struct {

	// Direction is the trim direction
	Direction TrimDirectionType
	// contains filtered or unexported fields
}

TrimDirectionExpr is an expression representing the trim direction used in the TRIM() function.

func (*TrimDirectionExpr) Accept

func (n *TrimDirectionExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TrimDirectionExpr) GetType

func (en *TrimDirectionExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*TrimDirectionExpr) Restore

func (n *TrimDirectionExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*TrimDirectionExpr) SetType

func (en *TrimDirectionExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type TrimDirectionType

type TrimDirectionType int

TrimDirectionType is the type for trim direction.

const (
	// TrimBothDefault trims from both direction by default.
	TrimBothDefault TrimDirectionType = iota
	// TrimBoth trims from both direction with explicit notation.
	TrimBoth
	// TrimLeading trims from left.
	TrimLeading
	// TrimTrailing trims from right.
	TrimTrailing
)

func (TrimDirectionType) String

func (direction TrimDirectionType) String() string

String implements fmt.Stringer interface.

type TruncateTableStmt

type TruncateTableStmt struct {
	Table *TableName
	// contains filtered or unexported fields
}

TruncateTableStmt is a statement to empty a table completely. See https://dev.mysql.com/doc/refman/5.7/en/truncate-table.html

func (*TruncateTableStmt) Accept

func (n *TruncateTableStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*TruncateTableStmt) Restore

func (n *TruncateTableStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type TypeOpt

type TypeOpt struct {
	IsUnsigned bool
	IsZerofill bool
}

TypeOpt is used for parsing data type option from SQL.

type UnaryOperationExpr

type UnaryOperationExpr struct {

	// Op is the operator opcode.
	Op opcode.Op
	// V is the unary expression.
	V ExprNode
	// contains filtered or unexported fields
}

UnaryOperationExpr is the expression for unary operator.

func (*UnaryOperationExpr) Accept

func (n *UnaryOperationExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UnaryOperationExpr) GetType

func (en *UnaryOperationExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*UnaryOperationExpr) Restore

func (n *UnaryOperationExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*UnaryOperationExpr) SetType

func (en *UnaryOperationExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type UninstallComponentStmt

type UninstallComponentStmt struct {
	Components []string
	// contains filtered or unexported fields
}

UninstallComponentStmt is an UNINSTALL COMPONENT statement.

func (*UninstallComponentStmt) Accept

func (n *UninstallComponentStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UninstallComponentStmt) Restore

func (n *UninstallComponentStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type UninstallPluginStmt

type UninstallPluginStmt struct {
	Name CIStr
	// contains filtered or unexported fields
}

UninstallPluginStmt is an UNINSTALL PLUGIN statement.

func (*UninstallPluginStmt) Accept

func (n *UninstallPluginStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UninstallPluginStmt) Restore

func (n *UninstallPluginStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type UnlockInstanceStmt

type UnlockInstanceStmt struct {
	// contains filtered or unexported fields
}

UnlockInstanceStmt is an UNLOCK INSTANCE statement.

func (*UnlockInstanceStmt) Accept

func (n *UnlockInstanceStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UnlockInstanceStmt) Restore

func (n *UnlockInstanceStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type UnlockTablesStmt

type UnlockTablesStmt struct {
	// contains filtered or unexported fields
}

UnlockTablesStmt is a statement to unlock tables.

func (*UnlockTablesStmt) Accept

func (n *UnlockTablesStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UnlockTablesStmt) Restore

func (n *UnlockTablesStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type UpdateStmt

type UpdateStmt struct {
	TableRefs     *TableRefsClause
	List          []*Assignment
	Where         ExprNode
	Order         *OrderByClause
	Limit         *Limit
	Priority      mysql.PriorityEnum
	IgnoreErr     bool
	MultipleTable bool
	TableHints    []*TableOptimizerHint
	With          *WithClause
	// contains filtered or unexported fields
}

UpdateStmt is a statement to update columns of existing rows in tables with new values. See https://dev.mysql.com/doc/refman/5.7/en/update.html

func (*UpdateStmt) Accept

func (n *UpdateStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UpdateStmt) Restore

func (n *UpdateStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*UpdateStmt) SetWhereExpr

func (n *UpdateStmt) SetWhereExpr(e ExprNode)

SetWhereExpr implements ShardableDMLStmt interface.

func (*UpdateStmt) TableRefsJoin

func (n *UpdateStmt) TableRefsJoin() (*Join, bool)

TableRefsJoin implements ShardableDMLStmt interface.

func (*UpdateStmt) WhereExpr

func (n *UpdateStmt) WhereExpr() ExprNode

WhereExpr implements ShardableDMLStmt interface.

type UseStmt

type UseStmt struct {
	DBName string
	// contains filtered or unexported fields
}

UseStmt is a statement to use the DBName database as the current database. See https://dev.mysql.com/doc/refman/5.7/en/use.html

func (*UseStmt) Accept

func (n *UseStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UseStmt) Restore

func (n *UseStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type UserSpec

type UserSpec struct {
	User               *auth.UserIdentity
	AuthOpt            *AuthOption
	DualPasswordOption DualPasswordOptionType
	IsRole             bool
	// ExtraAuthFactors are the second and third authentication factors of a
	// multi-factor spec: IDENTIFIED ... AND IDENTIFIED ... [AND IDENTIFIED ...]
	// (MySQL 8.0.27+). AuthOpt is the first factor.
	ExtraAuthFactors []*AuthOption
}

UserSpec is used for parsing create user statement.

func (*UserSpec) Restore

func (n *UserSpec) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*UserSpec) SecurityString

func (n *UserSpec) SecurityString() string

SecurityString formats the UserSpec without password information. The dual-password clause (RETAIN CURRENT PASSWORD / DISCARD OLD PASSWORD) is non-secret and is surfaced verbatim so the redacted output preserves the fact that the statement targets the secondary-password slot.

type UserToUser

type UserToUser struct {
	OldUser *auth.UserIdentity
	NewUser *auth.UserIdentity
	// contains filtered or unexported fields
}

UserToUser represents renaming old user to new user used in RenameUserStmt.

func (*UserToUser) Accept

func (n *UserToUser) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*UserToUser) OriginTextPosition

func (n *UserToUser) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*UserToUser) OriginalText

func (n *UserToUser) OriginalText() string

OriginalText implements Node interface.

func (*UserToUser) Restore

func (n *UserToUser) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*UserToUser) SetNoBackslashEscapes

func (n *UserToUser) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*UserToUser) SetOriginTextPosition

func (n *UserToUser) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*UserToUser) SetText

func (n *UserToUser) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*UserToUser) Text

func (n *UserToUser) Text() string

Text implements Node interface.

type ValueExpr

type ValueExpr struct {
	Datum
	// contains filtered or unexported fields
}

ValueExpr is the simple value expression.

func NewValueExpr

func NewValueExpr(value any, charset string, collate string) *ValueExpr

NewValueExpr creates a ValueExpr with value, and sets default field type.

func (*ValueExpr) Accept

func (n *ValueExpr) Accept(v Visitor) (Node, bool)

Accept implements Node interface.

func (*ValueExpr) GetDatumString

func (n *ValueExpr) GetDatumString() string

GetDatumString returns the string value of the datum.

func (*ValueExpr) GetProjectionOffset

func (n *ValueExpr) GetProjectionOffset() int

GetProjectionOffset returns ValueExpr.projectionOffset.

func (*ValueExpr) GetType

func (en *ValueExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ValueExpr) Restore

func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ValueExpr) SetProjectionOffset

func (n *ValueExpr) SetProjectionOffset(offset int)

SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder.

func (*ValueExpr) SetType

func (en *ValueExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type ValuesExpr

type ValuesExpr struct {

	// Column is column name.
	Column *ColumnNameExpr
	// contains filtered or unexported fields
}

ValuesExpr is the expression used in INSERT VALUES.

func (*ValuesExpr) Accept

func (n *ValuesExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*ValuesExpr) GetType

func (en *ValuesExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*ValuesExpr) Restore

func (n *ValuesExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*ValuesExpr) SetType

func (en *ValuesExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type VariableAssignment

type VariableAssignment struct {
	Name       string
	Value      ExprNode
	IsInstance bool
	IsGlobal   bool
	IsSystem   bool
	// IsPersist and IsPersistOnly are the SET PERSIST and
	// SET PERSIST_ONLY variable scopes.
	IsPersist     bool
	IsPersistOnly bool

	// ExtendValue is a way to store extended info.
	// VariableAssignment should be able to store information for SetCharset/SetPWD Stmt.
	// For SetCharsetStmt, Value is charset, ExtendValue is collation.
	// TODO: Use SetStmt to implement set password statement.
	ExtendValue *ValueExpr
	// contains filtered or unexported fields
}

VariableAssignment is a variable assignment struct.

func (*VariableAssignment) Accept

func (n *VariableAssignment) Accept(v Visitor) (Node, bool)

Accept implements Node interface.

func (*VariableAssignment) OriginTextPosition

func (n *VariableAssignment) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*VariableAssignment) OriginalText

func (n *VariableAssignment) OriginalText() string

OriginalText implements Node interface.

func (*VariableAssignment) Restore

func (n *VariableAssignment) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*VariableAssignment) SetNoBackslashEscapes

func (n *VariableAssignment) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*VariableAssignment) SetOriginTextPosition

func (n *VariableAssignment) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*VariableAssignment) SetText

func (n *VariableAssignment) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*VariableAssignment) Text

func (n *VariableAssignment) Text() string

Text implements Node interface.

type VariableExpr

type VariableExpr struct {

	// Name is the variable name.
	Name string
	// IsGlobal indicates whether this variable is global.
	IsGlobal bool
	// IsInstance indicates whether this variable is instance.
	IsInstance bool
	// IsSystem indicates whether this variable is a system variable in current session.
	IsSystem bool
	// ExplicitScope indicates whether this variable scope is set explicitly.
	ExplicitScope bool
	// Value is the variable value.
	Value ExprNode
	// contains filtered or unexported fields
}

VariableExpr is the expression for variable.

func (*VariableExpr) Accept

func (n *VariableExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*VariableExpr) GetType

func (en *VariableExpr) GetType() *types.FieldType

GetType implements ExprNode interface.

func (*VariableExpr) Restore

func (n *VariableExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*VariableExpr) SetType

func (en *VariableExpr) SetType(tp *types.FieldType)

SetType implements ExprNode interface.

type VcpuRange

type VcpuRange struct {
	Start uint64
	End   uint64
	// IsRange distinguishes "0-3" from a bare "0".
	IsRange bool
}

VcpuRange is one CPU or CPU range in a resource group VCPU list.

type ViewAlgorithm

type ViewAlgorithm int

ViewAlgorithm is VIEW's SQL ALGORITHM characteristic. See https://dev.mysql.com/doc/refman/5.7/en/view-algorithms.html

const (
	AlgorithmUndefined ViewAlgorithm = iota
	AlgorithmMerge
	AlgorithmTemptable
)

ViewAlgorithm values.

func (*ViewAlgorithm) String

func (v *ViewAlgorithm) String() string

String implements fmt.Stringer interface.

type ViewCheckOption

type ViewCheckOption int

ViewCheckOption is VIEW's WITH CHECK OPTION clause part. See https://dev.mysql.com/doc/refman/5.7/en/view-check-option.html

const (
	CheckOptionLocal ViewCheckOption = iota
	CheckOptionCascaded
)

ViewCheckOption values.

func (*ViewCheckOption) String

func (v *ViewCheckOption) String() string

String implements fmt.Stringer interface.

type ViewSecurity

type ViewSecurity int

ViewSecurity is VIEW's SQL SECURITY characteristic. See https://dev.mysql.com/doc/refman/5.7/en/create-view.html

const (
	SecurityDefiner ViewSecurity = iota
	SecurityInvoker
)

ViewSecurity values.

func (*ViewSecurity) String

func (v *ViewSecurity) String() string

String implements fmt.Stringer interface.

type Visitor

type Visitor interface {
	// Enter is called before children nodes are visited.
	// The returned node must be the same type as the input node n.
	// skipChildren returns true means children nodes should be skipped,
	// this is useful when work is done in Enter and there is no need to visit children.
	Enter(n Node) (node Node, skipChildren bool)
	// Leave is called after children nodes have been visited.
	// The returned node's type can be different from the input node if it is a ExprNode,
	// Non-expression node must be the same type as the input node n.
	// ok returns false to stop visiting.
	Leave(n Node) (node Node, ok bool)
}

Visitor visits a Node.

type WhenClause

type WhenClause struct {

	// Expr is the condition expression in WhenClause.
	Expr ExprNode
	// Result is the result expression in WhenClause.
	Result ExprNode
	// contains filtered or unexported fields
}

WhenClause is the when clause in Case expression for "when condition then result".

func (*WhenClause) Accept

func (n *WhenClause) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*WhenClause) OriginTextPosition

func (n *WhenClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*WhenClause) OriginalText

func (n *WhenClause) OriginalText() string

OriginalText implements Node interface.

func (*WhenClause) Restore

func (n *WhenClause) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*WhenClause) SetNoBackslashEscapes

func (n *WhenClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*WhenClause) SetOriginTextPosition

func (n *WhenClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*WhenClause) SetText

func (n *WhenClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*WhenClause) Text

func (n *WhenClause) Text() string

Text implements Node interface.

type WhileStmt

type WhileStmt struct {
	Label       CIStr
	HasEndLabel bool
	Cond        ExprNode
	Stmts       []StmtNode
	// contains filtered or unexported fields
}

WhileStmt is a WHILE ... END WHILE loop in a compound body.

func (*WhileStmt) Accept

func (n *WhileStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*WhileStmt) Restore

func (n *WhileStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type WildCardField

type WildCardField struct {
	Table  CIStr
	Schema CIStr
	// contains filtered or unexported fields
}

WildCardField is a special type of select field content.

func (*WildCardField) Accept

func (n *WildCardField) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*WildCardField) OriginTextPosition

func (n *WildCardField) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*WildCardField) OriginalText

func (n *WildCardField) OriginalText() string

OriginalText implements Node interface.

func (*WildCardField) Restore

func (n *WildCardField) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*WildCardField) SetNoBackslashEscapes

func (n *WildCardField) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*WildCardField) SetOriginTextPosition

func (n *WildCardField) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*WildCardField) SetText

func (n *WildCardField) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*WildCardField) Text

func (n *WildCardField) Text() string

Text implements Node interface.

type WindowFuncExpr

type WindowFuncExpr struct {

	// Name is the function name.
	Name string
	// Args is the function args.
	Args []ExprNode
	// Distinct cannot be true for most window functions, except `max` and `min`.
	// We need to raise error if it is not allowed to be true.
	Distinct bool
	// IgnoreNull indicates how to handle null value.
	// MySQL only supports `RESPECT NULLS`, so we need to raise error if it is true.
	IgnoreNull bool
	// FromLast indicates the calculation direction of this window function.
	// MySQL only supports calculation from first, so we need to raise error if it is true.
	FromLast bool
	// Spec is the specification of this window.
	Spec WindowSpec
	// contains filtered or unexported fields
}

WindowFuncExpr represents window function expression.

func (*WindowFuncExpr) Accept

func (n *WindowFuncExpr) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*WindowFuncExpr) Restore

func (n *WindowFuncExpr) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type WindowSpec

type WindowSpec struct {
	Name CIStr
	// Ref is the reference window of this specification. For example, in `w2 as (w1 order by a)`,
	// the definition of `w2` references `w1`.
	Ref CIStr

	PartitionBy *PartitionByClause
	OrderBy     *OrderByClause
	Frame       *FrameClause

	// OnlyAlias will set to true of the first following case.
	// To make compatible with MySQL, we need to distinguish `select func over w` from `select func over (w)`.
	OnlyAlias bool
	// contains filtered or unexported fields
}

WindowSpec is the specification of a window.

func (*WindowSpec) Accept

func (n *WindowSpec) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*WindowSpec) OriginTextPosition

func (n *WindowSpec) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*WindowSpec) OriginalText

func (n *WindowSpec) OriginalText() string

OriginalText implements Node interface.

func (*WindowSpec) Restore

func (n *WindowSpec) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

func (*WindowSpec) SetNoBackslashEscapes

func (n *WindowSpec) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*WindowSpec) SetOriginTextPosition

func (n *WindowSpec) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*WindowSpec) SetText

func (n *WindowSpec) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*WindowSpec) Text

func (n *WindowSpec) Text() string

Text implements Node interface.

type WithClause

type WithClause struct {
	IsRecursive bool
	CTEs        []*CommonTableExpression
	// contains filtered or unexported fields
}

func (*WithClause) Accept

func (n *WithClause) Accept(v Visitor) (Node, bool)

func (*WithClause) OriginTextPosition

func (n *WithClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*WithClause) OriginalText

func (n *WithClause) OriginalText() string

OriginalText implements Node interface.

func (*WithClause) Restore

func (n *WithClause) Restore(ctx *format.RestoreCtx) error

func (*WithClause) SetNoBackslashEscapes

func (n *WithClause) SetNoBackslashEscapes(val bool)

SetNoBackslashEscapes marks that the SQL mode NO_BACKSLASH_ESCAPES was active when this node was parsed, so backslash is not treated as an escape character in string literals

func (*WithClause) SetOriginTextPosition

func (n *WithClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*WithClause) SetText

func (n *WithClause) SetText(enc charset.Encoding, text string)

SetText implements Node interface.

func (*WithClause) Text

func (n *WithClause) Text() string

Text implements Node interface.

type XAOpType

type XAOpType int

XAOpType is the operation of an XA statement.

const (
	XAOpStart XAOpType = iota // XA {START|BEGIN}
	XAOpEnd
	XAOpPrepare
	XAOpCommit
	XAOpRollback
	XAOpRecover
)

XA operations.

type XAStmt

type XAStmt struct {
	Op  XAOpType
	Xid *XAXid // nil for XA RECOVER

	Join       bool // XA START ... JOIN
	Resume     bool // XA START ... RESUME
	Suspend    bool // XA END ... SUSPEND
	ForMigrate bool // XA END ... SUSPEND FOR MIGRATE
	OnePhase   bool // XA COMMIT ... ONE PHASE
	ConvertXid bool // XA RECOVER CONVERT XID
	// contains filtered or unexported fields
}

XAStmt is an XA transaction control statement. spirit does not support XA workloads (they binlog in ways the replication client cannot apply consistently), but the parser must recognize them so pkg/change can refuse them cleanly instead of failing to parse. See https://dev.mysql.com/doc/refman/8.4/en/xa-statements.html

func (*XAStmt) Accept

func (n *XAStmt) Accept(v Visitor) (Node, bool)

Accept implements Node Accept interface.

func (*XAStmt) Restore

func (n *XAStmt) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type XAXid

type XAXid struct {
	GTRID    string
	BQual    string
	FormatID uint64
	NParts   int
}

XAXid is the xid of an XA statement: gtrid [, bqual [, formatID]]. The gtrid and bqual are byte strings; NParts records how many parts were written so restore preserves the original shape.

func (*XAXid) Restore

func (x *XAXid) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

Jump to

Keyboard shortcuts

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