ast

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 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 (
	FlagConstant       uint64 = 0
	FlagHasParamMarker uint64 = 1 << iota
	FlagHasFunc
	FlagHasReference
	FlagHasAggregateFunc
	FlagHasSubquery
	FlagHasVariable
	FlagHasDefault
	FlagPreEvaluated
	FlagHasWindowFunc
)

Flags indicates whether an expression contains certain types of expression.

View Source
const (
	RowFormatDefault uint64 = iota + 1
	RowFormatDynamic
	RowFormatFixed
	RowFormatCompressed
	RowFormatRedundant
	RowFormatCompact
	TokuDBRowFormatDefault
	TokuDBRowFormatFast
	TokuDBRowFormatSmall
	TokuDBRowFormatZlib
	TokuDBRowFormatQuickLZ
	TokuDBRowFormatLzma
	TokuDBRowFormatSnappy
	TokuDBRowFormatUncompressed
	TokuDBRowFormatZstd
)

RowFormat types

View Source
const (
	TableOptionCharsetWithoutConvertTo uint64 = 0
	TableOptionCharsetWithConvertTo    uint64 = 1
)
View Source
const (
	Terminated = iota
	Enclosed
	Escaped
)
View Source
const (
	NoDryRun = iota
	DryRunQuery
	DryRunSplitDml
)
View Source
const (
	ShowNone = iota
	ShowEngines
	ShowDatabases
	ShowTables
	ShowTableStatus
	ShowColumns
	ShowWarnings
	ShowCharset
	ShowVariables
	ShowStatus
	ShowCollation
	ShowCreateTable
	ShowCreateView
	ShowCreateUser
	ShowCreateSequence
	ShowCreatePlacementPolicy
	ShowGrants
	ShowTriggers
	ShowProcedureStatus
	ShowIndex
	ShowProcessList
	ShowCreateDatabase
	ShowConfig
	ShowEvents
	ShowStatsExtended
	ShowStatsMeta
	ShowStatsHistograms
	ShowStatsTopN
	ShowStatsBuckets
	ShowStatsHealthy
	ShowStatsLocked
	ShowHistogramsInFlight
	ShowColumnStatsUsage
	ShowPlugins
	ShowProfile
	ShowProfiles
	ShowMasterStatus
	ShowPrivileges
	ShowErrors
	ShowBindings
	ShowBindingCacheStatus
	ShowPumpStatus
	ShowDrainerStatus
	ShowOpenTables
	ShowAnalyzeStatus
	ShowRegions
	ShowBuiltins
	ShowTableNextRowId
	ShowBackups
	ShowRestores
	ShowImports
	ShowCreateImport
	ShowPlacement
	ShowPlacementForDatabase
	ShowPlacementForTable
	ShowPlacementForPartition
	ShowPlacementLabels
	ShowSessionStates
)

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"

	// 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      = "'tidb`.(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      = "'tidb`.(timeliteral"
	TimeFormat       = "time_format"
	TimeToSec        = "time_to_sec"
	TimeDiff         = "timediff"
	Timestamp        = "timestamp"
	TimestampLiteral = "'tidb`.(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"
	// TSO functions
	// TiDBBoundedStaleness is used to determine the TS for a read only request with the given bounded staleness.
	// It will be used in the Stale Read feature.
	// For more info, please see AsOfClause.
	TiDBBoundedStaleness = "tidb_bounded_staleness"
	TiDBParseTso         = "tidb_parse_tso"
	TiDBCurrentTso       = "tidb_current_tso"

	// 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"
	TiDBVersion          = "tidb_version"
	TiDBIsDDLOwner       = "tidb_is_ddl_owner"
	TiDBDecodePlan       = "tidb_decode_plan"
	TiDBDecodeBinaryPlan = "tidb_decode_binary_plan"
	TiDBDecodeSQLDigests = "tidb_decode_sql_digests"
	FormatBytes          = "format_bytes"
	FormatNanoTime       = "format_nano_time"

	// 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"
	MasterPosWait   = "master_pos_wait"
	NameConst       = "name_const"
	ReleaseAllLocks = "release_all_locks"
	Sleep           = "sleep"
	UUID            = "uuid"
	UUIDShort       = "uuid_short"
	UUIDToBin       = "uuid_to_bin"
	BinToUUID       = "bin_to_uuid"
	VitessHash      = "vitess_hash"
	TiDBShard       = "tidb_shard"
	GetLock         = "get_lock"
	ReleaseLock     = "release_lock"

	// encryption and compression functions
	AesDecrypt               = "aes_decrypt"
	AesEncrypt               = "aes_encrypt"
	Compress                 = "compress"
	Decode                   = "decode"
	DesDecrypt               = "des_decrypt"
	DesEncrypt               = "des_encrypt"
	Encode                   = "encode"
	Encrypt                  = "encrypt"
	MD5                      = "md5"
	OldPassword              = "old_password"
	PasswordFunc             = "password_func"
	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"
	JSONInsert        = "json_insert"
	JSONReplace       = "json_replace"
	JSONRemove        = "json_remove"
	JSONContains      = "json_contains"
	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"
	JSONSearch        = "json_search"
	JSONStorageFree   = "json_storage_free"
	JSONStorageSize   = "json_storage_size"
	JSONDepth         = "json_depth"
	JSONKeys          = "json_keys"
	JSONLength        = "json_length"

	// TiDB internal function.
	TiDBDecodeKey       = "tidb_decode_key"
	TiDBDecodeBase64Key = "tidb_decode_base64_key"

	// MVCC information fetching function.
	GetMvccInfo = "get_mvcc_info"

	// Sequence function.
	NextVal = "nextval"
	LastVal = "lastval"
	SetVal  = "setval"
)

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"

	PumpType    = "PUMP"
	DrainerType = "DRAINER"
)

Isolation level constants.

View Source
const (
	Optimistic  = "OPTIMISTIC"
	Pessimistic = "PESSIMISTIC"
)

Transaction mode constants.

View Source
const (
	// CompactReplicaKindAll means compacting both TiKV and TiFlash replicas.
	CompactReplicaKindAll = "ALL"

	// CompactReplicaKindTiFlash means compacting TiFlash replicas.
	CompactReplicaKindTiFlash = "TIFLASH"

	// CompactReplicaKindTiKV means compacting TiKV replicas.
	CompactReplicaKindTiKV = "TIKV"
)
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
)
View Source
const (
	StatsTypeCardinality uint8 = iota
	StatsTypeDependency
	StatsTypeCorrelation
)

Extended statistics types.

View Source
const (
	AdminShowDDL = iota + 1
	AdminCheckTable
	AdminShowDDLJobs
	AdminCancelDDLJobs
	AdminCheckIndex
	AdminRecoverIndex
	AdminCleanupIndex
	AdminCheckIndexRange
	AdminShowDDLJobQueries
	AdminShowDDLJobQueriesWithRange
	AdminChecksumTable
	AdminShowSlow
	AdminShowNextRowID
	AdminReloadExprPushdownBlacklist
	AdminReloadOptRuleBlacklist
	AdminPluginDisable
	AdminPluginEnable
	AdminFlushBindings
	AdminCaptureBindings
	AdminEvolveBindings
	AdminReloadBindings
	AdminShowTelemetry
	AdminResetTelemetryID
	AdminReloadStatistics
	AdminFlushPlanCache
)

Admin statement types.

View Source
const (
	BRIEKindBackup BRIEKind = iota
	BRIEKindRestore

	// common BRIE options
	BRIEOptionRateLimit BRIEOptionType = iota + 1
	BRIEOptionConcurrency
	BRIEOptionChecksum
	BRIEOptionSendCreds
	BRIEOptionCheckpoint
	// backup options
	BRIEOptionBackupTimeAgo
	BRIEOptionBackupTS
	BRIEOptionBackupTSO
	BRIEOptionLastBackupTS
	BRIEOptionLastBackupTSO
	// restore options
	BRIEOptionOnline
	// import options
	BRIEOptionAnalyze
	BRIEOptionBackend
	BRIEOptionOnDuplicate
	BRIEOptionSkipSchemaFiles
	BRIEOptionStrictFormat
	BRIEOptionTiKVImporter
	BRIEOptionResume
	// CSV options
	BRIEOptionCSVBackslashEscape
	BRIEOptionCSVDelimiter
	BRIEOptionCSVHeader
	BRIEOptionCSVNotNull
	BRIEOptionCSVNull
	BRIEOptionCSVSeparator
	BRIEOptionCSVTrimLastSeparators

	BRIECSVHeaderIsColumns = ^uint64(0)
)
View Source
const (
	AnalyzeOptNumBuckets = iota
	AnalyzeOptNumTopN
	AnalyzeOptCMSketchDepth
	AnalyzeOptCMSketchWidth
	AnalyzeOptNumSamples
	AnalyzeOptSampleRate
)

Analyze option types.

View Source
const (
	UnspecifiedSize = math.MaxUint64
)

UnspecifiedSize is unspecified size.

Variables

View Source
var (
	ErrNoParts                              = terror.ClassDDL.NewStd(mysql.ErrNoParts)
	ErrPartitionColumnList                  = terror.ClassDDL.NewStd(mysql.ErrPartitionColumnList)
	ErrPartitionRequiresValues              = terror.ClassDDL.NewStd(mysql.ErrPartitionRequiresValues)
	ErrPartitionsMustBeDefined              = terror.ClassDDL.NewStd(mysql.ErrPartitionsMustBeDefined)
	ErrPartitionWrongNoPart                 = terror.ClassDDL.NewStd(mysql.ErrPartitionWrongNoPart)
	ErrPartitionWrongNoSubpart              = terror.ClassDDL.NewStd(mysql.ErrPartitionWrongNoSubpart)
	ErrPartitionWrongValues                 = terror.ClassDDL.NewStd(mysql.ErrPartitionWrongValues)
	ErrRowSinglePartitionField              = terror.ClassDDL.NewStd(mysql.ErrRowSinglePartitionField)
	ErrSubpartition                         = terror.ClassDDL.NewStd(mysql.ErrSubpartition)
	ErrSystemVersioningWrongPartitions      = terror.ClassDDL.NewStd(mysql.ErrSystemVersioningWrongPartitions)
	ErrTooManyValues                        = terror.ClassDDL.NewStd(mysql.ErrTooManyValues)
	ErrWrongPartitionTypeExpectedSystemTime = terror.ClassDDL.NewStd(mysql.ErrWrongPartitionTypeExpectedSystemTime)
	ErrUnknownCharacterSet                  = terror.ClassDDL.NewStd(mysql.ErrUnknownCharacterSet)
)
View Source
var AnalyzeOptionString = map[AnalyzeOptionType]string{
	AnalyzeOptNumBuckets:    "BUCKETS",
	AnalyzeOptNumTopN:       "TOPN",
	AnalyzeOptCMSketchWidth: "CMSKETCH WIDTH",
	AnalyzeOptCMSketchDepth: "CMSKETCH DEPTH",
	AnalyzeOptNumSamples:    "SAMPLES",
	AnalyzeOptSampleRate:    "SAMPLERATE",
}

AnalyzeOptionString stores the string form of analyze options.

View Source
var NewBitLiteral func(string) (interface{}, error)

NewBitLiteral creates a types.BitLiteral value, it's provided by parser driver.

View Source
var NewDecimal func(string) (interface{}, error)

NewDecimal creates a types.Decimal value, it's provided by parser driver.

View Source
var NewHexLiteral func(string) (interface{}, error)

NewHexLiteral creates a types.HexLiteral value, it's provided by parser driver.

View Source
var NewParamMarkerExpr func(offset int) ParamMarkerExpr

NewParamMarkerExpr creates a ParamMarkerExpr.

View Source
var NewValueExpr func(value interface{}, charset string, collate string) ValueExpr

NewValueExpr creates a ValueExpr with value, and sets default field type.

Functions

func ExpressionDeepEqual

func ExpressionDeepEqual(a ExprNode, b ExprNode) bool

ExpressionDeepEqual compares the equivalence of two expressions.

func GetStmtLabel

func GetStmtLabel(stmtNode StmtNode) string

GetStmtLabel generates a label for a statement.

func HasAggFlag

func HasAggFlag(expr ExprNode) bool

HasAggFlag checks if the expr contains FlagHasAggregateFunc.

func HasWindowFlag

func HasWindowFlag(expr ExprNode) bool

func IsReadOnly

func IsReadOnly(node Node) bool

IsReadOnly checks whether the input ast is readOnly.

func SetFlag

func SetFlag(n Node)

SetFlag sets flag for expression.

Types

type AdminStmt

type AdminStmt struct {
	Tp        AdminStmtType
	Index     string
	Tables    []*TableName
	JobIDs    []int64
	JobNumber int64

	HandleRanges   []HandleRange
	ShowSlow       *ShowSlow
	Plugins        []string
	Where          ExprNode
	StatementScope StatementScope
	LimitSimple    LimitSimple
	// contains filtered or unexported fields
}

AdminStmt is the struct for Admin statement.

func (*AdminStmt) Accept

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

Accept implements Node Accept interface.

func (*AdminStmt) Restore

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

Restore implements Node interface.

type AdminStmtType

type AdminStmtType int

AdminStmtType is the type for admin statement.

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) Format

func (n *AggregateFuncExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

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. For now, TiDB only supported inplace and instance algorithms. If the user specify `copy`, will get an error.

func (AlgorithmType) String

func (a AlgorithmType) String() string

type AlterDatabaseStmt

type AlterDatabaseStmt struct {
	Name                 model.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 AlterImportStmt

type AlterImportStmt struct {
	Name          string
	ErrorHandling ErrorHandlingOption
	Options       []*BRIEOption
	Truncate      *ImportTruncate
	// contains filtered or unexported fields
}

func (*AlterImportStmt) Accept

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

func (*AlterImportStmt) Restore

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

type AlterInstanceStmt

type AlterInstanceStmt struct {
	ReloadTLS         bool
	NoRollbackOnError bool
	// contains filtered or unexported fields
}

AlterInstanceStmt modifies instance. See https://dev.mysql.com/doc/refman/8.0/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 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) 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 AlterPlacementPolicyStmt

type AlterPlacementPolicyStmt struct {
	PolicyName       model.CIStr
	IfExists         bool
	PlacementOptions []*PlacementOption
	// contains filtered or unexported fields
}

AlterPlacementPolicyStmt is a statement to alter placement policy option.

func (*AlterPlacementPolicyStmt) Accept

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

func (*AlterPlacementPolicyStmt) Restore

type AlterSequenceStmt

type AlterSequenceStmt struct {

	// sequence name
	Name *TableName

	IfExists   bool
	SeqOptions []*SequenceOption
	// contains filtered or unexported fields
}

AlterSequenceStmt is a statement to alter sequence option.

func (*AlterSequenceStmt) Accept

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

func (*AlterSequenceStmt) Restore

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

type AlterTableSpec

type AlterTableSpec struct {

	// only supported by MariaDB 10.0.2+ (DROP COLUMN, CHANGE COLUMN, MODIFY COLUMN, DROP INDEX, DROP FOREIGN KEY, DROP PARTITION)
	// see https://mariadb.com/kb/en/library/alter-table/
	IfExists bool

	// only supported by MariaDB 10.0.2+ (ADD COLUMN, ADD PARTITION)
	// see https://mariadb.com/kb/en/library/alter-table/
	IfNotExists bool

	NoWriteToBinlog bool
	OnAllPartitions bool

	Tp               AlterTableType
	Name             string
	IndexName        model.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          model.CIStr
	ToKey            model.CIStr
	Partition        *PartitionOptions
	PartitionNames   []model.CIStr
	PartDefinitions  []*PartitionDefinition
	WithValidation   bool
	Num              uint64
	Visibility       IndexVisibility
	TiFlashReplica   *TiFlashReplicaSpec
	Writeable        bool
	Statistics       *StatisticsSpec
	AttributesSpec   *AttributesSpec
	StatsOptionsSpec *StatsOptionsSpec
	// 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) IsAllPlacementRule

func (n *AlterTableSpec) IsAllPlacementRule() bool

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) 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) HaveOnlyPlacementOptions

func (n *AlterTableStmt) HaveOnlyPlacementOptions() bool

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
	AlterTableWriteable
	AlterTableAlgorithm
	AlterTableRenameIndex
	AlterTableForce
	AlterTableAddPartitions

	AlterTablePartitionAttributes
	AlterTablePartitionOptions
	AlterTableCoalescePartitions
	AlterTableDropPartition
	AlterTableTruncatePartition
	AlterTablePartition
	AlterTableEnableKeys
	AlterTableDisableKeys
	AlterTableRemovePartitioning
	AlterTableWithValidation
	AlterTableWithoutValidation
	AlterTableSecondaryLoad
	AlterTableSecondaryUnload
	AlterTableRebuildPartition
	AlterTableReorganizePartition
	AlterTableCheckPartitions
	AlterTableExchangePartition
	AlterTableOptimizePartition
	AlterTableRepairPartition
	AlterTableImportPartitionTablespace
	AlterTableDiscardPartitionTablespace
	AlterTableAlterCheck
	AlterTableDropCheck
	AlterTableImportTablespace
	AlterTableDiscardTablespace
	AlterTableIndexInvisible
	// TODO: Add more actions
	AlterTableOrderByColumns
	// AlterTableSetTiFlashReplica uses to set the table TiFlash replica.
	AlterTableSetTiFlashReplica

	AlterTableAddStatistics
	AlterTableDropStatistics
	AlterTableAttributes
	AlterTableCache
	AlterTableNoCache
	AlterTableStatsOptions
	AlterTableDropFirstPartition
	AlterTableAddLastPartition
	AlterTableReorganizeLastPartition
	AlterTableReorganizeFirstPartition
	AlterTableRemoveTTL
)

AlterTable types.

type AlterUserStmt

type AlterUserStmt struct {
	IfExists                 bool
	CurrentAuth              *AuthOption
	Specs                    []*UserSpec
	AuthTokenOrTLSOptions    []*AuthTokenOrTLSOption
	ResourceOptions          []*ResourceOption
	PasswordOrLockOptions    []*PasswordOrLockOption
	CommentOrAttributeOption *CommentOrAttributeOption
	// 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.

func (*AlterUserStmt) SecureText

func (n *AlterUserStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type AnalyzeOpt

type AnalyzeOpt struct {
	Type  AnalyzeOptionType
	Value ValueExpr
}

AnalyzeOpt stores the analyze option type and value.

type AnalyzeOptionType

type AnalyzeOptionType int

AnalyzeOptType is the type for analyze options.

type AnalyzeTableStmt

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

	// IndexFlag is true when we only analyze indices for a table.
	IndexFlag   bool
	Incremental bool
	// HistogramOperation is set in "ANALYZE TABLE ... UPDATE/DROP HISTOGRAM ..." statement.
	HistogramOperation HistogramOperationType
	// ColumnNames indicate the columns whose statistics need to be collected.
	ColumnNames  []model.CIStr
	ColumnChoice model.ColumnChoice
	// contains filtered or unexported fields
}

AnalyzeTableStmt is used to create table statistics.

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 AsOfClause

type AsOfClause struct {
	TsExpr ExprNode
	// contains filtered or unexported fields
}

func (*AsOfClause) Accept

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

Accept implements Node Accept interface.

func (*AsOfClause) OriginTextPosition

func (n *AsOfClause) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*AsOfClause) OriginalText

func (n *AsOfClause) OriginalText() string

OriginalText implements Node interface.

func (*AsOfClause) Restore

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

Restore implements Node interface.

func (*AsOfClause) SetOriginTextPosition

func (n *AsOfClause) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*AsOfClause) SetText

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

SetText implements Node interface.

func (*AsOfClause) Text

func (n *AsOfClause) Text() string

Text 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) 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 AttributesSpec

type AttributesSpec struct {
	Attributes string
	Default    bool
	// contains filtered or unexported fields
}

func (*AttributesSpec) Accept

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

func (*AttributesSpec) OriginTextPosition

func (n *AttributesSpec) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*AttributesSpec) OriginalText

func (n *AttributesSpec) OriginalText() string

OriginalText implements Node interface.

func (*AttributesSpec) Restore

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

func (*AttributesSpec) SetOriginTextPosition

func (n *AttributesSpec) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*AttributesSpec) SetText

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

SetText implements Node interface.

func (*AttributesSpec) Text

func (n *AttributesSpec) 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
}

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 AutoRandomOption

type AutoRandomOption struct {
	// ShardBits is the number of bits used to store the shard.
	ShardBits int
	// RangeBits is the number of int primary key bits that will be used by TiDB.
	RangeBits int
}

AutoRandomOption contains the length of shard bits and range bits.

type BRIEKind

type BRIEKind uint8

func (BRIEKind) String

func (kind BRIEKind) String() string

type BRIEOption

type BRIEOption struct {
	Tp        BRIEOptionType
	StrValue  string
	UintValue uint64
}

func (*BRIEOption) Restore

func (opt *BRIEOption) Restore(ctx *format.RestoreCtx) error

type BRIEOptionLevel

type BRIEOptionLevel uint64
const (
	BRIEOptionLevelOff      BRIEOptionLevel = iota // equals FALSE
	BRIEOptionLevelRequired                        // equals TRUE
	BRIEOptionLevelOptional
)

func (BRIEOptionLevel) String

func (level BRIEOptionLevel) String() string

type BRIEOptionType

type BRIEOptionType uint16

func (BRIEOptionType) String

func (kind BRIEOptionType) String() string

type BRIEStmt

type BRIEStmt struct {
	Kind    BRIEKind
	Schemas []string
	Tables  []*TableName
	Storage string
	Options []*BRIEOption
	// contains filtered or unexported fields
}

BRIEStmt is a statement for backup, restore, import and export.

func (*BRIEStmt) Accept

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

func (*BRIEStmt) Restore

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

func (*BRIEStmt) SecureText

func (n *BRIEStmt) SecureText() string

SecureText implements SensitiveStmtNode

type BeginStmt

type BeginStmt struct {
	Mode                  string
	CausalConsistencyOnly bool
	ReadOnly              bool
	// AS OF is used to read the data at a specific point of time.
	// Should only be used when ReadOnly is true.
	AsOf *AsOfClause
	// 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) Format

func (n *BetweenExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*BetweenExpr) GetFlag

func (en *BetweenExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *BetweenExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*BetweenExpr) SetType

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

SetType implements ExprNode interface.

type BinaryLiteral

type BinaryLiteral interface {
	ToString() string
}

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) Format

func (n *BinaryOperationExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*BinaryOperationExpr) GetFlag

func (en *BinaryOperationExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *BinaryOperationExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*BinaryOperationExpr) SetType

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

SetType implements ExprNode interface.

type BindingStatusType

type BindingStatusType int8

BindingStatusType defines the status type for the binding

const (
	BindingStatusTypeEnabled BindingStatusType = iota
	BindingStatusTypeDisabled
)

Binding status types.

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 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) 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 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) Format

func (n *CaseExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*CaseExpr) GetFlag

func (en *CaseExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *CaseExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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 ChangeStmt

type ChangeStmt struct {
	NodeType string
	State    string
	NodeID   string
	// contains filtered or unexported fields
}

func (*ChangeStmt) Accept

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

Accept implements Node Accept interface.

func (*ChangeStmt) Restore

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

Restore implements Node interface.

func (*ChangeStmt) SecureText

func (n *ChangeStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type CharsetOpt

type CharsetOpt struct {
	Chs string
	Col string
}

CharsetOpt is used for parsing charset option from SQL.

type CleanupTableLockStmt

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

CleanupTableLockStmt is a statement to cleanup table lock.

func (*CleanupTableLockStmt) Accept

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

Accept implements Node Accept interface.

func (*CleanupTableLockStmt) Restore

func (n *CleanupTableLockStmt) 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) 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() bool

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 model.CIStr
	Table  model.CIStr
	Name   model.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) 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) 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

	// Refer is the result field the column name refers to.
	// The value of Refer.Expr is used as the value of the expression.
	Refer *ResultField
	// 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) Format

func (n *ColumnNameExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ColumnNameExpr) GetFlag

func (en *ColumnNameExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *ColumnNameExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) 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
	AutoRandOpt AutoRandomOption
	// Enforced is only for Check, default is true.
	Enforced bool
	// Name is only used for Check Constraint name.
	ConstraintName string
	PrimaryKeyTp   model.PrimaryKeyType
	// 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) 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 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.
	ColumnOptionFulltext
	ColumnOptionComment
	ColumnOptionGenerated
	ColumnOptionReference
	ColumnOptionCollate
	ColumnOptionCheck
	ColumnOptionColumnFormat
	ColumnOptionStorage
	ColumnOptionAutoRandom
)

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) 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        model.CIStr
	Query       *SubqueryExpr
	ColNameList []model.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) 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 CompactReplicaKind

type CompactReplicaKind string

type CompactTableStmt

type CompactTableStmt struct {
	Table          *TableName
	PartitionNames []model.CIStr
	ReplicaKind    CompactReplicaKind
	// contains filtered or unexported fields
}

CompactTableStmt is a statement to manually compact a table.

func (*CompactTableStmt) Accept

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

Accept implements Node Accept interface.

func (*CompactTableStmt) Restore

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

Restore 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) Format

func (n *CompareSubqueryExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*CompareSubqueryExpr) GetFlag

func (en *CompareSubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *CompareSubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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 {

	// only supported by MariaDB 10.0.2+ (ADD {INDEX|KEY}, ADD FOREIGN KEY),
	// see https://mariadb.com/kb/en/library/alter-table/
	IfNotExists bool

	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) 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
	ConstraintCheck
)

ConstraintTypes

type CreateBindingStmt

type CreateBindingStmt struct {
	GlobalScope bool
	OriginNode  StmtNode
	HintedNode  StmtNode
	PlanDigest  string
	// contains filtered or unexported fields
}

CreateBindingStmt creates sql binding hint.

func (*CreateBindingStmt) Accept

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

func (*CreateBindingStmt) Restore

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

type CreateDatabaseStmt

type CreateDatabaseStmt struct {
	IfNotExists bool
	Name        model.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 CreateImportStmt

type CreateImportStmt struct {
	IfNotExists   bool
	Name          string
	Storage       string
	ErrorHandling ErrorHandlingOption
	Options       []*BRIEOption
	// contains filtered or unexported fields
}

func (*CreateImportStmt) Accept

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

func (*CreateImportStmt) Restore

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

func (*CreateImportStmt) SecureText

func (n *CreateImportStmt) SecureText() string

SecureText implements SensitiveStmtNode

type CreateIndexStmt

type CreateIndexStmt struct {

	// only supported by MariaDB 10.0.2+,
	// see https://mariadb.com/kb/en/library/create-index/
	IfNotExists bool

	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 CreatePlacementPolicyStmt

type CreatePlacementPolicyStmt struct {
	OrReplace        bool
	IfNotExists      bool
	PolicyName       model.CIStr
	PlacementOptions []*PlacementOption
	// contains filtered or unexported fields
}

CreatePlacementPolicyStmt is a statement to create a policy.

func (*CreatePlacementPolicyStmt) Accept

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

Accept implements Node Accept interface.

func (*CreatePlacementPolicyStmt) Restore

Restore implements Node interface.

type CreateSequenceStmt

type CreateSequenceStmt struct {

	// TODO : support or replace if need : care for it will conflict on temporaryOpt.
	IfNotExists bool
	Name        *TableName
	SeqOptions  []*SequenceOption
	TblOptions  []*TableOption
	// contains filtered or unexported fields
}

CreateSequenceStmt is a statement to create a Sequence.

func (*CreateSequenceStmt) Accept

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

Accept implements Node Accept interface.

func (*CreateSequenceStmt) Restore

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

Restore implements Node interface.

type CreateStatisticsStmt

type CreateStatisticsStmt struct {
	IfNotExists bool
	StatsName   string
	StatsType   uint8
	Table       *TableName
	Columns     []*ColumnName
	// contains filtered or unexported fields
}

CreateStatisticsStmt is a statement to create extended statistics. Examples:

CREATE STATISTICS stats1 (cardinality) ON t(a, b, c);
CREATE STATISTICS stats2 (dependency) ON t(a, b);
CREATE STATISTICS stats3 (correlation) ON t(a, b);

func (*CreateStatisticsStmt) Accept

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

Accept implements Node Accept interface.

func (*CreateStatisticsStmt) Restore

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

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
	// 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 CreateUserStmt

type CreateUserStmt struct {
	IsCreateRole             bool
	IfNotExists              bool
	Specs                    []*UserSpec
	AuthTokenOrTLSOptions    []*AuthTokenOrTLSOption
	ResourceOptions          []*ResourceOption
	PasswordOrLockOptions    []*PasswordOrLockOption
	CommentOrAttributeOption *CommentOrAttributeOption
	// 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.

func (*CreateUserStmt) SecureText

func (n *CreateUserStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type CreateViewStmt

type CreateViewStmt struct {
	OrReplace   bool
	ViewName    *TableName
	Cols        []model.CIStr
	Select      StmtNode
	SchemaCols  []model.CIStr
	Algorithm   model.ViewAlgorithm
	Definer     *auth.UserIdentity
	Security    model.ViewSecurity
	CheckOption model.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
	TiFlashReplica *TiFlashReplicaSpec
}

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
	DatabaseSetTiFlashReplica
	DatabaseOptionPlacementPolicy = DatabaseOptionType(PlacementOptionPolicy)
)

Database option types.

type DateArithType

type DateArithType byte

DateArithType is type for DateArith type.

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 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) Format

func (n *DefaultExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*DefaultExpr) GetFlag

func (en *DefaultExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *DefaultExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) 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 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 DropBindingStmt

type DropBindingStmt struct {
	GlobalScope bool
	OriginNode  StmtNode
	HintedNode  StmtNode
	SQLDigest   string
	// contains filtered or unexported fields
}

DropBindingStmt deletes sql binding hint.

func (*DropBindingStmt) Accept

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

func (*DropBindingStmt) Restore

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

type DropDatabaseStmt

type DropDatabaseStmt struct {
	IfExists bool
	Name     model.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 DropImportStmt

type DropImportStmt struct {
	IfExists bool
	Name     string
	// contains filtered or unexported fields
}

func (*DropImportStmt) Accept

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

func (*DropImportStmt) Restore

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

type DropIndexStmt

type DropIndexStmt struct {
	IfExists  bool
	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 DropPlacementPolicyStmt

type DropPlacementPolicyStmt struct {
	IfExists   bool
	PolicyName model.CIStr
	// contains filtered or unexported fields
}

DropPlacementPolicyStmt is a statement to drop a Policy.

func (*DropPlacementPolicyStmt) Accept

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

func (*DropPlacementPolicyStmt) Restore

Restore implements Restore interface.

type DropSequenceStmt

type DropSequenceStmt struct {
	IfExists  bool
	Sequences []*TableName
	// contains filtered or unexported fields
}

DropSequenceStmt is a statement to drop a Sequence.

func (*DropSequenceStmt) Accept

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

Accept implements Node Accept interface.

func (*DropSequenceStmt) Restore

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

Restore implements Node interface.

type DropStatisticsStmt

type DropStatisticsStmt struct {
	StatsName string
	// contains filtered or unexported fields
}

DropStatisticsStmt is a statement to drop extended statistics. Examples:

DROP STATISTICS stats1;

func (*DropStatisticsStmt) Accept

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

Accept implements Node Accept interface.

func (*DropStatisticsStmt) Restore

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

Restore implements Node interface.

type DropStatsStmt

type DropStatsStmt struct {
	Tables         []*TableName
	PartitionNames []model.CIStr
	IsGlobalStats  bool
	// contains filtered or unexported fields
}

DropStatsStmt is used to drop table statistics. if the PartitionNames is not empty, or IsGlobalStats is true, it will contain exactly one table

func (*DropStatsStmt) Accept

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

Accept implements Node Accept interface.

func (*DropStatsStmt) Restore

func (n *DropStatsStmt) 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 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 ErrorHandlingOption

type ErrorHandlingOption uint64

ErrorHandlingOption is used in async IMPORT related stmt

const (
	ErrorHandleError ErrorHandlingOption = iota
	ErrorHandleReplace
	ErrorHandleSkipAll
	ErrorHandleSkipConstraint
	ErrorHandleSkipDuplicate
	ErrorHandleSkipStrict
)

func (ErrorHandlingOption) String

func (o ErrorHandlingOption) String() string

type ExecuteStmt

type ExecuteStmt struct {
	Name       string
	UsingVars  []ExprNode
	BinaryArgs interface{}
	PrepStmt   interface{} // the corresponding prepared statement
	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) Format

func (n *ExistsSubqueryExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ExistsSubqueryExpr) GetFlag

func (en *ExistsSubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *ExistsSubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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
	// 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
	// SetFlag sets flag to the expression.
	// Flag indicates whether the expression contains
	// parameter marker, reference, aggregate function...
	SetFlag(flag uint64)
	// GetFlag returns the flag of the expression.
	GetFlag() uint64

	// Format formats the AST into a writer.
	Format(w io.Writer)
}

ExprNode is a node that can be evaluated. Name of implementations should have 'Expr' suffix.

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) 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    byte
	Escaped     byte
	OptEnclosed 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 FlashBackDatabaseStmt

type FlashBackDatabaseStmt struct {
	DBName  model.CIStr
	NewName string
	// contains filtered or unexported fields
}

FlashBackDatabaseStmt is a statement to restore a database and all tables in the database.

func (*FlashBackDatabaseStmt) Accept

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

Accept implements Node Accept interface.

func (*FlashBackDatabaseStmt) Restore

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

Restore implements Node interface.

type FlashBackTableStmt

type FlashBackTableStmt struct {
	Table   *TableName
	NewName string
	// contains filtered or unexported fields
}

FlashBackTableStmt is a statement to restore a dropped/truncate table.

func (*FlashBackTableStmt) Accept

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

Accept implements Node Accept interface.

func (*FlashBackTableStmt) Restore

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

Restore implements Node interface.

type FlashBackToTimestampStmt

type FlashBackToTimestampStmt struct {
	FlashbackTS ExprNode
	Tables      []*TableName
	DBName      model.CIStr
	// contains filtered or unexported fields
}

FlashBackToTimestampStmt is a statement to restore the cluster to the specified timestamp

func (*FlashBackToTimestampStmt) Accept

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

Accept implements Node Accept interface.

func (*FlashBackToTimestampStmt) Restore

Restore implements Node interface

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
	Plugins         []string
	// 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
	FlushTiDBPlugin
	FlushHosts
	FlushLogs
	FlushClientErrorsSummary
)

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) 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) 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 FuncCallExpr

type FuncCallExpr struct {
	Tp     FuncCallExprType
	Schema model.CIStr
	// FnName is the function name.
	FnName model.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) Format

func (n *FuncCallExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

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
	// 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) Format

func (n *FuncCastExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

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 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) Format

func (n *GetFormatSelectorExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*GetFormatSelectorExpr) GetFlag

func (en *GetFormatSelectorExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *GetFormatSelectorExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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 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
	// 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.

func (*GrantRoleStmt) SecureText

func (n *GrantRoleStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type GrantStmt

type GrantStmt struct {
	Privs                 []*PrivElem
	ObjectType            ObjectTypeType
	Level                 *GrantLevel
	Users                 []*UserSpec
	AuthTokenOrTLSOptions []*AuthTokenOrTLSOption
	WithGrant             bool
	// 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.

func (*GrantStmt) SecureText

func (n *GrantStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type GroupByClause

type GroupByClause struct {
	Items []*ByItem
	// 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) 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 HandleRange

type HandleRange struct {
	Begin int64
	End   int64
}

HandleRange represents a range where handle value >= Begin and < End.

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) 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 a statement for server side help 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 HintSetVar

type HintSetVar struct {
	VarName string
	Value   string
}

HintSetVar is the payload of `SET_VAR` hint

type HintTable

type HintTable struct {
	DBName        model.CIStr
	TableName     model.CIStr
	QBName        model.CIStr
	PartitionList []model.CIStr
}

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

func (*HintTable) Restore

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

type HintTimeRange

type HintTimeRange struct {
	From string
	To   string
}

HintTimeRange is the payload of `TIME_RANGE` hint

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 Ident

type Ident struct {
	Schema model.CIStr
	Name   model.CIStr
}

Ident is the table identifier composed of schema name and table name.

func (Ident) String

func (i Ident) String() string

String implements fmt.Stringer interface.

type ImportTruncate

type ImportTruncate struct {
	IsErrorsOnly bool
	TableNames   []*TableName
}

type IndexAdviseStmt

type IndexAdviseStmt struct {
	IsLocal     bool
	Path        string
	MaxMinutes  uint64
	MaxIndexNum *MaxIndexNumClause
	LinesInfo   *LinesClause
	// contains filtered or unexported fields
}

IndexAdviseStmt is used to advise indexes

func (*IndexAdviseStmt) Accept

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

Accept implements Node Accept interface.

func (*IndexAdviseStmt) Restore

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

Restore implements Node Accept interface.

type IndexHint

type IndexHint struct {
	IndexNames []model.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
)

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) 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           model.IndexType
	Comment      string
	ParserName   model.CIStr
	Visibility   IndexVisibility
	PrimaryKeyTp model.PrimaryKeyType
	// contains filtered or unexported fields
}

IndexOption is the index options.

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

See http://dev.mysql.com/doc/refman/5.7/en/create-table.html

func (*IndexOption) Accept

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

Accept implements Node Accept interface.

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) 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) 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 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     []*Assignment
	Priority    mysql.PriorityEnum
	OnDuplicate []*Assignment
	Select      ResultSetNode
	// TableHints represents the table level Optimizer Hint for join type.
	TableHints     []*TableOptimizerHint
	PartitionNames []model.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 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) Format

func (n *IsNullExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*IsNullExpr) GetFlag

func (en *IsNullExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *IsNullExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) Format

func (n *IsTruthExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*IsTruthExpr) GetFlag

func (en *IsTruthExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *IsTruthExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*IsTruthExpr) SetType

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

SetType implements ExprNode interface.

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) 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
	// TiDBExtension is used to indicate whether the user knows he is sending kill statement to the right tidb-server.
	// When the SQL grammar is "KILL TIDB [CONNECTION | QUERY] connectionID", TiDBExtension will be set.
	// It's a special grammar extension in TiDB. This extension exists because, when the connection is:
	// client -> LVS proxy -> TiDB, and type Ctrl+C in client, the following action will be executed:
	// new a connection; kill xxx;
	// kill command may send to the wrong TiDB, because the exists of LVS proxy, and kill the wrong session.
	// So, "KILL TIDB" grammar is introduced, and it REQUIRES DIRECT client -> TiDB TOPOLOGY.
	// TODO: The standard KILL grammar will be supported once we have global connectionID.
	TiDBExtension bool

	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 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) 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 LimitSimple

type LimitSimple struct {
	Count  uint64
	Offset uint64
}

LimitSimple is the struct for Admin statement limit option.

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 {
	IsLocal           bool
	Path              string
	OnDuplicate       OnDuplicateKeyHandlingType
	Table             *TableName
	Columns           []*ColumnName
	FieldsInfo        *FieldsClause
	LinesInfo         *LinesClause
	IgnoreLines       uint64
	ColumnAssignments []*Assignment

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

LoadDataStmt is a statement to load data from a specified file, then insert this rows into an existing table. See https://dev.mysql.com/doc/refman/5.7/en/load-data.html

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 LoadStatsStmt

type LoadStatsStmt struct {
	Path string
	// contains filtered or unexported fields
}

LoadStatsStmt is the statement node for loading statistic.

func (*LoadStatsStmt) Accept

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

Accept implements Node Accept interface.

func (*LoadStatsStmt) Restore

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

Restore implements Node interface.

type LockStatsStmt

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

LockStatsStmt is the statement node for lock table statistic

func (*LockStatsStmt) Accept

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

Accept implements Node Accept interface.

func (*LockStatsStmt) Restore

func (n *LockStatsStmt) 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
)

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) Format

func (n *MatchAgainst) Format(w io.Writer)

func (*MatchAgainst) GetFlag

func (en *MatchAgainst) GetFlag() uint64

GetFlag implements ExprNode interface.

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) SetFlag

func (en *MatchAgainst) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

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 MaxIndexNumClause

type MaxIndexNumClause struct {
	PerTable uint64
	PerDB    uint64
}

MaxIndexNumClause represents 'maximum number of indexes' clause in index advise statement.

func (*MaxIndexNumClause) Restore

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

Restore for max index num clause

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) Format

func (n *MaxValueExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*MaxValueExpr) GetFlag

func (en *MaxValueExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *MaxValueExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*MaxValueExpr) SetType

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

SetType implements ExprNode interface.

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.
	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 NonTransactionalDMLStmt

type NonTransactionalDMLStmt struct {
	DryRun      int         // 0: no dry run, 1: dry run the query, 2: dry run split DMLs
	ShardColumn *ColumnName // if it's nil, the handle column is automatically chosen for it
	Limit       uint64
	DMLStmt     ShardableDMLStmt
	// contains filtered or unexported fields
}

func (*NonTransactionalDMLStmt) Accept

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

Accept implements Node Accept interface.

func (*NonTransactionalDMLStmt) Restore

Restore implements Node interface.

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
)

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) 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 model.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) 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 model.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) 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 OptBinary

type OptBinary struct {
	IsBinary bool
	Charset  string
}

OptBinary is used for parser.

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) 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 interface {
	ValueExpr
	SetOrder(int)
}

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

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) Format

func (n *ParenthesesExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ParenthesesExpr) GetFlag

func (en *ParenthesesExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *ParenthesesExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) 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    model.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 model.PartitionType, columns int) error
	// contains filtered or unexported methods
}

type PartitionDefinitionClauseHistory

type PartitionDefinitionClauseHistory struct {
	Current bool
}

func (*PartitionDefinitionClauseHistory) Validate

type PartitionDefinitionClauseIn

type PartitionDefinitionClauseIn struct {
	Values [][]ExprNode
}

func (*PartitionDefinitionClauseIn) Validate

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

type PartitionDefinitionClauseLessThan

type PartitionDefinitionClauseLessThan struct {
	Exprs []ExprNode
}

func (*PartitionDefinitionClauseLessThan) Validate

type PartitionDefinitionClauseNone

type PartitionDefinitionClauseNone struct{}

func (*PartitionDefinitionClauseNone) Validate

type PartitionInterval

type PartitionInterval struct {
	IntervalExpr  PartitionIntervalExpr
	FirstRangeEnd *ExprNode
	LastRangeEnd  *ExprNode
	MaxValPart    bool
	NullPart      bool
	// contains filtered or unexported fields
}

func (*PartitionInterval) OriginTextPosition

func (n *PartitionInterval) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*PartitionInterval) OriginalText

func (n *PartitionInterval) OriginalText() string

OriginalText implements Node interface.

func (*PartitionInterval) SetOriginTextPosition

func (n *PartitionInterval) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*PartitionInterval) SetText

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

SetText implements Node interface.

func (*PartitionInterval) Text

func (n *PartitionInterval) Text() string

Text implements Node interface.

type PartitionIntervalExpr

type PartitionIntervalExpr struct {
	Expr ExprNode
	// TimeUnitInvalid if not Time based INTERVAL!
	TimeUnit TimeUnitType
}

type PartitionKeyAlgorithm

type PartitionKeyAlgorithm struct {
	Type uint64
}

type PartitionMethod

type PartitionMethod struct {

	// Tp is the type of the partition function
	Tp model.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
	// Unit is a time unit used as argument of SYSTEM_TIME type
	Unit TimeUnitType
	// Limit is a row count used as argument of the SYSTEM_TIME type
	Limit uint64

	// 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

	Interval *PartitionInterval
	// 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) 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) 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 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) Format

func (n *PatternInExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*PatternInExpr) GetFlag

func (en *PatternInExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *PatternInExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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

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

PatternLikeExpr is the expression for 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) Format

func (n *PatternLikeExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*PatternLikeExpr) GetFlag

func (en *PatternLikeExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *PatternLikeExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) Format

func (n *PatternRegexpExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*PatternRegexpExpr) GetFlag

func (en *PatternRegexpExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *PatternRegexpExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*PatternRegexpExpr) SetType

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

SetType implements ExprNode interface.

type PlacementOption

type PlacementOption struct {
	Tp        PlacementOptionType
	StrValue  string
	UintValue uint64
}

PlacementOption is used for parsing placement option.

func (*PlacementOption) Restore

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

type PlacementOptionType

type PlacementOptionType int

PlacementOptionType is the type for PlacementOption

const (
	PlacementOptionPrimaryRegion PlacementOptionType = 0x3000 + iota
	PlacementOptionRegions
	PlacementOptionFollowerCount
	PlacementOptionVoterCount
	PlacementOptionLearnerCount
	PlacementOptionSchedule
	PlacementOptionConstraints
	PlacementOptionLeaderConstraints
	PlacementOptionLearnerConstraints
	PlacementOptionFollowerConstraints
	PlacementOptionVoterConstraints
	PlacementOptionSurvivalPreferences
	PlacementOptionPolicy
)

PlacementOption types.

type PlanReplayerStmt

type PlanReplayerStmt struct {
	Stmt    StmtNode
	Analyze bool
	Load    bool

	// Capture indicates 'plan replayer capture <sql_digest> <plan_digest>'
	Capture    bool
	SQLDigest  string
	PlanDigest string

	// File is used to store 2 cases:
	// 1. plan replayer load 'file';
	// 2. plan replayer dump explain <analyze> 'file'
	File string
	// Where is the where clause in select statement.
	Where ExprNode
	// OrderBy is the ordering expression list.
	OrderBy *OrderByClause
	// Limit is the limit clause.
	Limit *Limit
	// contains filtered or unexported fields
}

PlanReplayerStmt is a statement to dump or load information for recreating plans

func (*PlanReplayerStmt) Accept

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

Accept implements Node Accept interface.

func (*PlanReplayerStmt) Restore

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

Restore implements Node interface.

type PositionExpr

type PositionExpr struct {

	// N is the position, started from 1 now.
	N int
	// P is the parameterized position.
	P ExprNode
	// Refer is the result field the position refers to.
	Refer *ResultField
	// 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) Format

func (n *PositionExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*PositionExpr) GetFlag

func (en *PositionExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *PositionExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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 Prepared

type Prepared struct {
	Stmt          StmtNode
	StmtType      string
	Params        []ParamMarkerExpr
	SchemaVersion int64
	UseCache      bool
	CachedPlan    interface{}
	CachedNames   interface{}
}

Prepared represents a prepared statement.

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) 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 PurgeImportStmt

type PurgeImportStmt struct {
	TaskID uint64
	// contains filtered or unexported fields
}

func (*PurgeImportStmt) Accept

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

func (*PurgeImportStmt) Restore

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

type RecoverTableStmt

type RecoverTableStmt struct {
	JobID  int64
	Table  *TableName
	JobNum int64
	// contains filtered or unexported fields
}

RecoverTableStmt is a statement to recover dropped table.

func (*RecoverTableStmt) Accept

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

Accept implements Node Accept interface.

func (*RecoverTableStmt) Restore

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

Restore implements Node 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) 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 {
	Table      *TableName
	CreateStmt *CreateTableStmt
	// contains filtered or unexported fields
}

RepairTableStmt is a statement to repair tableInfo.

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 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 TiDB server. 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 ResultField

type ResultField struct {
	Column       *model.ColumnInfo
	ColumnAsName model.CIStr
	Table        *model.TableInfo
	TableAsName  model.CIStr
	DBName       model.CIStr

	// Expr represents the expression for the result field. If it is generated from a select field, it would
	// be the expression of that select field, otherwise the type would be ValueExpr and value
	// will be set for every retrieved row.
	Expr      ExprNode
	TableName *TableName
	// Referenced indicates the result field has been referenced or not.
	// If not, we don't need to get the values.
	Referenced bool
}

ResultField represents a result field which can be a column from a table, or an expression in select field. It is a generated property during binding process. ResultField is the key element to evaluate a ColumnNameExpr. After resolving process, every ColumnNameExpr will be resolved to a ResultField. During execution, every row retrieved from table will set the row value to ResultFields of that table, so ColumnNameExpr resolved to that ResultField can be easily evaluated.

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 ResumeImportStmt

type ResumeImportStmt struct {
	IfNotRunning bool
	Name         string
	// contains filtered or unexported fields
}

func (*ResumeImportStmt) Accept

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

func (*ResumeImportStmt) Restore

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

type RevokeRoleStmt

type RevokeRoleStmt struct {
	Roles []*auth.RoleIdentity
	Users []*auth.UserIdentity
	// contains filtered or unexported fields
}

RevokeStmt is the struct for REVOKE statement.

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 {
	Privs      []*PrivElem
	ObjectType ObjectTypeType
	Level      *GrantLevel
	Users      []*UserSpec
	// 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    interface{} // 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 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) Format

func (n *RowExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*RowExpr) GetFlag

func (en *RowExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *RowExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*RowExpr) SetType

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

SetType implements ExprNode interface.

type SampleClauseUnitType

type SampleClauseUnitType int8
const (
	SampleClauseUnitTypeDefault SampleClauseUnitType = iota
	SampleClauseUnitTypeRow
	SampleClauseUnitTypePercent
)

type SampleMethodType

type SampleMethodType int8
const (
	SampleMethodTypeNone SampleMethodType = iota
	SampleMethodTypeSystem
	SampleMethodTypeBernoulli
	SampleMethodTypeTiDBRegion
)

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 model.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) 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) 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
	FieldsInfo *FieldsClause
	LinesInfo  *LinesClause
	// 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) 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
	// OrderBy is the ordering expression list.
	OrderBy *OrderByClause
	// Limit is the limit clause.
	Limit *Limit
	// LockInfo is the lock type
	LockInfo *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 SensitiveStmtNode

type SensitiveStmtNode interface {
	StmtNode
	// SecureText is different from Text that it hide password information.
	SecureText() string
}

SensitiveStmtNode overloads StmtNode and provides a SecureText method.

type SequenceOption

type SequenceOption struct {
	Tp       SequenceOptionType
	IntValue int64
}

SequenceOption is used for parsing sequence option from SQL.

func (*SequenceOption) Restore

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

type SequenceOptionType

type SequenceOptionType int

SequenceOptionType is the type for SequenceOption

const (
	SequenceOptionNone SequenceOptionType = iota
	SequenceOptionIncrementBy
	SequenceStartWith
	SequenceNoMinValue
	SequenceMinValue
	SequenceNoMaxValue
	SequenceMaxValue
	SequenceNoCache
	SequenceCache
	SequenceNoCycle
	SequenceCycle
	// SequenceRestart is only used in alter sequence statement.
	SequenceRestart
	SequenceRestartWith
)

SequenceOption types.

type SetBindingStmt

type SetBindingStmt struct {
	BindingStatusType BindingStatusType
	OriginNode        StmtNode
	HintedNode        StmtNode
	// contains filtered or unexported fields
}

SetBindingStmt sets sql binding status.

func (*SetBindingStmt) Accept

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

func (*SetBindingStmt) Restore

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

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) Format

func (n *SetCollationExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*SetCollationExpr) GetFlag

func (en *SetCollationExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *SetCollationExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*SetCollationExpr) SetType

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

SetType implements ExprNode interface.

type SetConfigStmt

type SetConfigStmt struct {
	Type     string // TiDB, TiKV, PD
	Instance string // '127.0.0.1:3306'
	Name     string // the variable name
	Value    ExprNode
	// contains filtered or unexported fields
}

SetConfigStmt is the statement to set cluster configs.

func (*SetConfigStmt) Accept

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

func (*SetConfigStmt) Restore

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

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
	// 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) 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
	// contains filtered or unexported fields
}

SetOprStmt represents "union/except/intersect statement" See https://dev.mysql.com/doc/refman/5.7/en/union.html See https://mariadb.com/kb/en/intersect/ See https://mariadb.com/kb/en/except/

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
	// 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.

func (*SetPwdStmt) SecureText

func (n *SetPwdStmt) SecureText() string

SecureText implements SensitiveStatement 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 SetSessionStatesStmt

type SetSessionStatesStmt struct {
	SessionStates string
	// contains filtered or unexported fields
}

SetSessionStatesStmt is a statement to restore session states.

func (*SetSessionStatesStmt) Accept

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

func (*SetSessionStatesStmt) Restore

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

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 ShardableDMLStmt

type ShardableDMLStmt = interface {
	StmtNode
	WhereExpr() ExprNode
	SetWhereExpr(ExprNode)
	// TableRefsJoin returns the table refs in the statement.
	TableRefsJoin() (refs *Join, ok bool)
}

type ShowImportStmt

type ShowImportStmt struct {
	Name       string
	ErrorsOnly bool
	TableNames []*TableName
	// contains filtered or unexported fields
}

func (*ShowImportStmt) Accept

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

func (*ShowImportStmt) Restore

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

type ShowSlow

type ShowSlow struct {
	Tp    ShowSlowType
	Count uint64
	Kind  ShowSlowKind
}

ShowSlow is used for the following command:

admin show slow top [ internal | all] N
admin show slow recent N

func (*ShowSlow) Restore

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

Restore implements Node interface.

type ShowSlowKind

type ShowSlowKind int

ShowSlowKind defines the kind for SlowSlow statement when the type is ShowSlowTop.

const (
	// ShowSlowKindDefault is a ShowSlowKind constant.
	ShowSlowKindDefault ShowSlowKind = iota
	// ShowSlowKindInternal is a ShowSlowKind constant.
	ShowSlowKindInternal
	// ShowSlowKindAll is a ShowSlowKind constant.
	ShowSlowKindAll
)

type ShowSlowType

type ShowSlowType int

ShowSlowType defines the type for SlowSlow statement.

const (
	// ShowSlowTop is a ShowSlowType constant.
	ShowSlowTop ShowSlowType = iota
	// ShowSlowRecent is a ShowSlowType constant.
	ShowSlowRecent
)

type ShowStmt

type ShowStmt struct {
	Tp          ShowStmtType // Databases/Tables/Columns/....
	DBName      string
	Table       *TableName  // Used for showing columns.
	Partition   model.CIStr // Used for showing partition.
	Column      *ColumnName // Used for `desc table column`.
	IndexName   model.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` and `show bindings`
	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
	// 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) NeedLimitRSRow

func (n *ShowStmt) NeedLimitRSRow() bool

Allow limit result set for partial SHOW cmd

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 TiDB server. See https://dev.mysql.com/doc/refman/5.7/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 SplitOption

type SplitOption struct {
	Lower      []ExprNode
	Upper      []ExprNode
	Num        int64
	ValueLists [][]ExprNode
}

func (*SplitOption) Restore

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

type SplitRegionStmt

type SplitRegionStmt struct {
	Table          *TableName
	IndexName      model.CIStr
	PartitionNames []model.CIStr

	SplitSyntaxOpt *SplitSyntaxOption

	SplitOpt *SplitOption
	// contains filtered or unexported fields
}

func (*SplitRegionStmt) Accept

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

func (*SplitRegionStmt) Restore

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

type SplitSyntaxOption

type SplitSyntaxOption struct {
	HasRegionFor bool
	HasPartition bool
}

type StatementScope

type StatementScope int
const (
	StatementScopeNone StatementScope = iota
	StatementScopeSession
	StatementScopeInstance
	StatementScopeGlobal
)

type StatisticsSpec

type StatisticsSpec struct {
	StatsName string
	StatsType uint8
	Columns   []*ColumnName
}

StatisticsSpec is the specification for ADD /DROP STATISTICS.

type StatsOptionType

type StatsOptionType int
const (
	StatsOptionBuckets StatsOptionType = 0x5000 + iota
	StatsOptionTopN
	StatsOptionColsChoice
	StatsOptionColList
	StatsOptionSampleRate
)

type StatsOptionsSpec

type StatsOptionsSpec struct {
	StatsOptions string
	Default      bool
	// contains filtered or unexported fields
}

func (*StatsOptionsSpec) Accept

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

func (*StatsOptionsSpec) OriginTextPosition

func (n *StatsOptionsSpec) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*StatsOptionsSpec) OriginalText

func (n *StatsOptionsSpec) OriginalText() string

OriginalText implements Node interface.

func (*StatsOptionsSpec) Restore

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

func (*StatsOptionsSpec) SetOriginTextPosition

func (n *StatsOptionsSpec) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*StatsOptionsSpec) SetText

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

SetText implements Node interface.

func (*StatsOptionsSpec) Text

func (n *StatsOptionsSpec) Text() string

Text implements Node interface.

type StmtNode

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

StmtNode represents statement node. Name of implementations should have 'Stmt' suffix.

type StopImportStmt

type StopImportStmt struct {
	IfRunning bool
	Name      string
	// contains filtered or unexported fields
}

func (*StopImportStmt) Accept

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

func (*StopImportStmt) Restore

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

type SubPartitionDefinition

type SubPartitionDefinition struct {
	Name    model.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) Format

func (n *SubqueryExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*SubqueryExpr) GetFlag

func (en *SubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *SubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*SubqueryExpr) SetType

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

SetType implements ExprNode interface.

type TableLock

type TableLock struct {
	Table *TableName
	Type  model.TableLockType
}

TableLock contains the table name and lock type.

type TableName

type TableName struct {
	Schema model.CIStr
	Name   model.CIStr

	DBInfo    *model.DBInfo
	TableInfo *model.TableInfo

	IndexHints     []*IndexHint
	PartitionNames []model.CIStr
	TableSample    *TableSample
	// AS OF is used to see the data as it was at a specific point in time.
	AsOf *AsOfClause
	// 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) 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 TableNameExpr

type TableNameExpr struct {

	// Name is the referenced object name expression.
	Name *TableName
	// contains filtered or unexported fields
}

TableNameExpr represents a table-level object name expression, such as sequence/table/view etc.

func (*TableNameExpr) Accept

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

Accept implements Node Accept interface.

func (*TableNameExpr) Format

func (n *TableNameExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*TableNameExpr) GetFlag

func (en *TableNameExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*TableNameExpr) GetType

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

GetType implements ExprNode interface.

func (*TableNameExpr) Restore

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

Restore implements Node interface.

func (*TableNameExpr) SetFlag

func (en *TableNameExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*TableNameExpr) SetType

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

SetType implements ExprNode 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 model.CIStr
	// HintData is the payload of the hint. The actual type of this field
	// is defined differently as according `HintName`. Define as following:
	//
	// Statement Execution Time Optimizer Hints
	// See https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html#optimizer-hints-execution-time
	// - MAX_EXECUTION_TIME  => uint64
	// - MEMORY_QUOTA        => int64
	// - QUERY_TYPE          => model.CIStr
	//
	// Time Range is used to hint the time range of inspection tables
	// e.g: select /*+ time_range(”,”) */ * from information_schema.inspection_result.
	// - TIME_RANGE          => ast.HintTimeRange
	// - READ_FROM_STORAGE   => model.CIStr
	// - USE_TOJA            => bool
	// - NTH_PLAN            => int64
	HintData interface{}
	// QBName is the default effective query block of this hint.
	QBName  model.CIStr
	Tables  []HintTable
	Indexes []model.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) 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) 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
	TableOptionAutoRandomBase
	TableOptionComment
	TableOptionAvgRowLength
	TableOptionCheckSum
	TableOptionCompression
	TableOptionConnection
	TableOptionPassword
	TableOptionKeyBlockSize
	TableOptionMaxRows
	TableOptionMinRows
	TableOptionDelayKeyWrite
	TableOptionRowFormat
	TableOptionStatsPersistent
	TableOptionStatsAutoRecalc
	TableOptionShardRowID
	TableOptionPreSplitRegion
	TableOptionPackKeys
	TableOptionTablespace
	TableOptionNodegroup
	TableOptionDataDirectory
	TableOptionIndexDirectory
	TableOptionStorageMedia
	TableOptionStatsSamplePages
	TableOptionSecondaryEngine
	TableOptionSecondaryEngineNull
	TableOptionInsertMethod
	TableOptionTableCheckSum
	TableOptionUnion
	TableOptionEncryption
	TableOptionTTL
	TableOptionTTLEnable
	TableOptionPlacementPolicy = TableOptionType(PlacementOptionPolicy)
	TableOptionStatsBuckets    = TableOptionType(StatsOptionBuckets)
	TableOptionStatsTopN       = TableOptionType(StatsOptionTopN)
	TableOptionStatsColsChoice = TableOptionType(StatsOptionColsChoice)
	TableOptionStatsColList    = TableOptionType(StatsOptionColList)
	TableOptionStatsSampleRate = TableOptionType(StatsOptionSampleRate)
)

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) 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 TableSample

type TableSample struct {
	SampleMethod     SampleMethodType
	Expr             ExprNode
	SampleClauseUnit SampleClauseUnitType
	RepeatableSeed   ExprNode
	// contains filtered or unexported fields
}

func (*TableSample) Accept

func (s *TableSample) Accept(v Visitor) (node Node, ok bool)

func (*TableSample) OriginTextPosition

func (n *TableSample) OriginTextPosition() int

OriginTextPosition implements Node interface.

func (*TableSample) OriginalText

func (n *TableSample) OriginalText() string

OriginalText implements Node interface.

func (*TableSample) Restore

func (s *TableSample) Restore(ctx *format.RestoreCtx) error

func (*TableSample) SetOriginTextPosition

func (n *TableSample) SetOriginTextPosition(offset int)

SetOriginTextPosition implements Node interface.

func (*TableSample) SetText

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

SetText implements Node interface.

func (*TableSample) Text

func (n *TableSample) 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 model.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) 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) 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 TemporaryKeyword

type TemporaryKeyword int
const (
	TemporaryNone TemporaryKeyword = iota
	TemporaryGlobal
	TemporaryLocal
)

type TexprNode

type TexprNode = exprNode

TexprNode is exported for parser driver.

type TextString

type TextString struct {
	Value           string
	IsBinaryLiteral bool
}

TextString represent a string, it can be a binary literal.

type TiFlashReplicaSpec

type TiFlashReplicaSpec struct {
	Count  uint64
	Labels []string
}

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) Format

func (n *TimeUnitExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*TimeUnitExpr) GetFlag

func (en *TimeUnitExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *TimeUnitExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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 TraceStmt

type TraceStmt struct {
	Stmt   StmtNode
	Format string

	TracePlan       bool
	TracePlanTarget string
	// contains filtered or unexported fields
}

TraceStmt is a statement to trace what sql actually does at background.

func (*TraceStmt) Accept

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

Accept implements Node Accept interface.

func (*TraceStmt) Restore

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

Restore implements Node interface.

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) Format

func (n *TrimDirectionExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*TrimDirectionExpr) GetFlag

func (en *TrimDirectionExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *TrimDirectionExpr) SetFlag(flag uint64)

SetFlag implements ExprNode 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) Format

func (n *UnaryOperationExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*UnaryOperationExpr) GetFlag

func (en *UnaryOperationExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *UnaryOperationExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*UnaryOperationExpr) SetType

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

SetType implements ExprNode interface.

type UnlockStatsStmt

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

UnlockStatsStmt is the statement node for unlock table statistic

func (*UnlockStatsStmt) Accept

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

Accept implements Node Accept interface.

func (*UnlockStatsStmt) Restore

func (n *UnlockStatsStmt) 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
	IsRole  bool
}

UserSpec is used for parsing create user statement.

func (*UserSpec) EncodedPassword

func (n *UserSpec) EncodedPassword() (string, bool)

EncodedPassword returns the encoded password (which is the real data mysql.user). The boolean value indicates input's password format is legal or not.

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.

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) 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 interface {
	ExprNode
	SetValue(val interface{})
	GetValue() interface{}
	GetDatumString() string
	GetString() string
	GetProjectionOffset() int
	SetProjectionOffset(offset int)
}

ValueExpr define a interface for ValueExpr.

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) Format

func (n *ValuesExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*ValuesExpr) GetFlag

func (en *ValuesExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *ValuesExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*ValuesExpr) SetType

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

SetType implements ExprNode interface.

type VariableAssignment

type VariableAssignment struct {
	Name     string
	Value    ExprNode
	IsGlobal bool
	IsSystem 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) 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
	// 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) Format

func (n *VariableExpr) Format(w io.Writer)

Format the ExprNode into a Writer.

func (*VariableExpr) GetFlag

func (en *VariableExpr) GetFlag() uint64

GetFlag implements ExprNode 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) SetFlag

func (en *VariableExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*VariableExpr) SetType

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

SetType implements ExprNode 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) 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 WildCardField

type WildCardField struct {
	Table  model.CIStr
	Schema model.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) 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 {

	// F is the function name.
	F 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) Format

func (n *WindowFuncExpr) Format(w io.Writer)

Format formats the window function expression into a Writer.

func (*WindowFuncExpr) Restore

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

Restore implements Node interface.

type WindowSpec

type WindowSpec struct {
	Name model.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 model.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) 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) 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.

Jump to

Keyboard shortcuts

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