parser: github.com/pingcap/parser/ast Index | Files

package ast

import "github.com/pingcap/parser/ast"

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

Index

Package Files

ast.go base.go ddl.go dml.go expressions.go flag.go functions.go misc.go stats.go util.go

Constants

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.

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

RowFormat types

const (
    Terminated = iota
    Enclosed
    Escaped
)
const (
    ShowNone = iota
    ShowEngines
    ShowDatabases
    ShowTables
    ShowTableStatus
    ShowColumns
    ShowWarnings
    ShowCharset
    ShowVariables
    ShowStatus
    ShowCollation
    ShowCreateTable
    ShowCreateView
    ShowCreateUser
    ShowGrants
    ShowTriggers
    ShowProcedureStatus
    ShowIndex
    ShowProcessList
    ShowCreateDatabase
    ShowEvents
    ShowStatsMeta
    ShowStatsHistograms
    ShowStatsBuckets
    ShowStatsHealthy
    ShowPlugins
    ShowProfile
    ShowProfiles
    ShowMasterStatus
    ShowPrivileges
    ShowErrors
    ShowBindings
    ShowPumpStatus
    ShowDrainerStatus
    ShowOpenTables
    ShowAnalyzeStatus
    ShowRegions
    ShowBuiltins
)

Show statement types.

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

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

const (
    Following = iota
    Preceding
    CurrentRow
)

Frame bound types.

const (
    FulltextSearchModifierNaturalLanguageMode = 0
    FulltextSearchModifierBooleanMode         = 1
    FulltextSearchModifierModeMask            = 0xF
    FulltextSearchModifierWithQueryExpansion  = 1 << 4
)
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"
    IsNull     = "isnull"
    IsTruth    = "istrue"  // Avoid name conflict with IsTrue in github/pingcap/check.
    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"
    TiDBParseTso     = "tidb_parse_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"
    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"

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

    // 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"
    MasterPosWait   = "master_pos_wait"
    NameConst       = "name_const"
    ReleaseAllLocks = "release_all_locks"
    Sleep           = "sleep"
    UUID            = "uuid"
    UUIDShort       = "uuid_short"
    // get_lock() and release_lock() is parsed but do nothing.
    // It is used for preventing error in Ruby's activerecord migrations.
    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"
    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"
    JSONStorageSize   = "json_storage_size"
    JSONDepth         = "json_depth"
    JSONKeys          = "json_keys"
    JSONLength        = "json_length"

    // TiDB internal function.
    TiDBDecodeKey = "tidb_decode_key"
)

List scalar function names.

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 function
    AggFuncStddevPop = "stddev_pop"
    // AggFuncStddevSamp is the name of stddev_samp function
    AggFuncStddevSamp = "stddev_samp"
)
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"
)
const (
    ReadCommitted   = "READ-COMMITTED"
    ReadUncommitted = "READ-UNCOMMITTED"
    Serializable    = "SERIALIZABLE"
    RepeatableRead  = "REPEATABLE-READ"

    // Valid formats for explain statement.
    ExplainFormatROW = "row"
    ExplainFormatDOT = "dot"
    PumpType         = "PUMP"
    DrainerType      = "DRAINER"
)

Isolation level constants.

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

Transaction mode constants.

const (
    TslNone = iota
    Ssl
    X509
    Cipher
    Issuer
    Subject
)
const (
    MaxQueriesPerHour = iota + 1
    MaxUpdatesPerHour
    MaxConnectionsPerHour
    MaxUserConnections
)
const (
    PasswordExpire = iota + 1
    PasswordExpireDefault
    PasswordExpireNever
    PasswordExpireInterval
    Lock
    Unlock
)
const (
    AdminShowDDL = iota + 1
    AdminCheckTable
    AdminShowDDLJobs
    AdminCancelDDLJobs
    AdminCheckIndex
    AdminRecoverIndex
    AdminCleanupIndex
    AdminCheckIndexRange
    AdminShowDDLJobQueries
    AdminChecksumTable
    AdminShowSlow
    AdminShowNextRowID
    AdminReloadExprPushdownBlacklist
    AdminReloadOptRuleBlacklist
    AdminPluginDisable
    AdminPluginEnable
)

Admin statement types.

const (
    AnalyzeOptNumBuckets = iota
    AnalyzeOptNumTopN
    AnalyzeOptCMSketchDepth
    AnalyzeOptCMSketchWidth
    AnalyzeOptNumSamples
)

Analyze option types.

const (
    // SetNames is the const for set names/charset stmt.
    // If VariableAssignment.Name == Names, it should be set names/charset stmt.
    SetNames = "SetNAMES"
)

Variables

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)
)
var AnalyzeOptionString = map[AnalyzeOptionType]string{
    AnalyzeOptNumBuckets:    "BUCKETS",
    AnalyzeOptNumTopN:       "TOPN",
    AnalyzeOptCMSketchWidth: "CMSKETCH WIDTH",
    AnalyzeOptCMSketchDepth: "CMSKETCH DEPTH",
    AnalyzeOptNumSamples:    "SAMPLES",
}

AnalyzeOptionString stores the string form of analyze options.

var (
    // ExplainFormats stores the valid formats for explain statement, used by validator.
    ExplainFormats = []string{
        ExplainFormatROW,
        ExplainFormatDOT,
    }
)
var NewBitLiteral func(string) (interface{}, error)

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

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

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

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

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

var NewParamMarkerExpr func(offset int) ParamMarkerExpr

NewParamMarkerExpr creates a ParamMarkerExpr.

var NewValueExpr func(interface{}) ValueExpr

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

func HasAggFlag Uses

func HasAggFlag(expr ExprNode) bool

HasAggFlag checks if the expr contains FlagHasAggregateFunc.

func HasWindowFlag Uses

func HasWindowFlag(expr ExprNode) bool

func IsReadOnly Uses

func IsReadOnly(node Node) bool

IsReadOnly checks whether the input ast is readOnly.

func SetFlag Uses

func SetFlag(n Node)

SetFlag sets flag for expression.

type AdminStmt Uses

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

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

AdminStmt is the struct for Admin statement.

func (*AdminStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*AdminStmt) Restore Uses

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

Restore implements Node interface.

type AdminStmtType Uses

type AdminStmtType int

AdminStmtType is the type for admin statement.

type AggregateFuncExpr Uses

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

AggregateFuncExpr represents aggregate function expression.

func (*AggregateFuncExpr) Accept Uses

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

Accept implements Node Accept interface.

func (*AggregateFuncExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*AggregateFuncExpr) Restore Uses

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

Restore implements Node interface.

type AlgorithmType Uses

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 Uses

func (a AlgorithmType) String() string

type AlterDatabaseStmt Uses

type AlterDatabaseStmt struct {
    Name                 string
    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 Uses

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

Accept implements Node Accept interface.

func (*AlterDatabaseStmt) Restore Uses

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

Restore implements Node interface.

type AlterOrderItem Uses

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

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

Restore implements Node interface.

func (*AlterOrderItem) SetText Uses

func (n *AlterOrderItem) SetText(text string)

SetText implements Node interface.

func (*AlterOrderItem) Text Uses

func (n *AlterOrderItem) Text() string

Text implements Node interface.

type AlterTableSpec Uses

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

AlterTableSpec represents alter table specification.

func (*AlterTableSpec) Accept Uses

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

Accept implements Node Accept interface.

func (*AlterTableSpec) Restore Uses

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

Restore implements Node interface.

func (*AlterTableSpec) SetText Uses

func (n *AlterTableSpec) SetText(text string)

SetText implements Node interface.

func (*AlterTableSpec) Text Uses

func (n *AlterTableSpec) Text() string

Text implements Node interface.

type AlterTableStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*AlterTableStmt) Restore Uses

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

Restore implements Node interface.

type AlterTableType Uses

type AlterTableType int

AlterTableType is the type for AlterTableSpec.

const (
    AlterTableOption AlterTableType = iota + 1
    AlterTableAddColumns
    AlterTableAddConstraint
    AlterTableDropColumn
    AlterTableDropPrimaryKey
    AlterTableDropIndex
    AlterTableDropForeignKey
    AlterTableModifyColumn
    AlterTableChangeColumn
    AlterTableRenameColumn
    AlterTableRenameTable
    AlterTableAlterColumn
    AlterTableLock
    AlterTableAlgorithm
    AlterTableRenameIndex
    AlterTableForce
    AlterTableAddPartitions
    AlterTableCoalescePartitions
    AlterTableDropPartition
    AlterTableTruncatePartition
    AlterTablePartition
    AlterTableEnableKeys
    AlterTableDisableKeys
    AlterTableRemovePartitioning
    AlterTableWithValidation
    AlterTableWithoutValidation
    AlterTableSecondaryLoad
    AlterTableSecondaryUnload
    AlterTableRebuildPartition
    AlterTableReorganizePartition
    AlterTableCheckPartitions
    AlterTableExchangePartition
    AlterTableOptimizePartition
    AlterTableRepairPartition
    AlterTableImportPartitionTablespace
    AlterTableDiscardPartitionTablespace
    AlterTableAlterCheck
    AlterTableDropCheck
    AlterTableImportTablespace
    AlterTableDiscardTablespace
    AlterTableIndexInvisible
    // TODO: Add more actions
    AlterTableOrderByColumns
    // AlterTableSetTiFlashReplica uses to set the table TiFlash replica.
    AlterTableSetTiFlashReplica
)

AlterTable types.

type AlterUserStmt Uses

type AlterUserStmt struct {
    IfExists              bool
    CurrentAuth           *AuthOption
    Specs                 []*UserSpec
    TslOptions            []*TslOption
    ResourceOptions       []*ResourceOption
    PasswordOrLockOptions []*PasswordOrLockOption
    // contains filtered or unexported fields
}

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

func (*AlterUserStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*AlterUserStmt) Restore Uses

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

Restore implements Node interface.

func (*AlterUserStmt) SecureText Uses

func (n *AlterUserStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type AnalyzeOpt Uses

type AnalyzeOpt struct {
    Type  AnalyzeOptionType
    Value uint64
}

AnalyzeOpt stores the analyze option type and value.

type AnalyzeOptionType Uses

type AnalyzeOptionType int

AnalyzeOptType is the type for analyze options.

type AnalyzeTableStmt Uses

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

AnalyzeTableStmt is used to create table statistics.

func (*AnalyzeTableStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*AnalyzeTableStmt) Restore Uses

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

Restore implements Node interface.

type Assignment Uses

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 Uses

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

Accept implements Node Accept interface.

func (*Assignment) Restore Uses

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

Restore implements Node interface.

func (*Assignment) SetText Uses

func (n *Assignment) SetText(text string)

SetText implements Node interface.

func (*Assignment) Text Uses

func (n *Assignment) Text() string

Text implements Node interface.

type AuthOption Uses

type AuthOption struct {
    // ByAuthString set as true, if AuthString is used for authorization. Otherwise, authorization is done by HashString.
    ByAuthString bool
    AuthString   string
    HashString   string
}

AuthOption is used for parsing create use statement.

func (*AuthOption) Restore Uses

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

Restore implements Node interface.

type BeginStmt Uses

type BeginStmt struct {
    Mode     string
    ReadOnly bool
    Bound    *TimestampBound
    // 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 Uses

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

Accept implements Node Accept interface.

func (*BeginStmt) Restore Uses

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

Restore implements Node interface.

type BetweenExpr Uses

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 Uses

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

Accept implements Node interface.

func (*BetweenExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*BetweenExpr) GetFlag Uses

func (en *BetweenExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*BetweenExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*BetweenExpr) Restore Uses

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

Restore implements Node interface.

func (*BetweenExpr) SetFlag Uses

func (en *BetweenExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*BetweenExpr) SetType Uses

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

SetType implements ExprNode interface.

type BinaryLiteral Uses

type BinaryLiteral interface {
    ToString() string
}

type BinaryOperationExpr Uses

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 Uses

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

Accept implements Node interface.

func (*BinaryOperationExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*BinaryOperationExpr) GetFlag Uses

func (en *BinaryOperationExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*BinaryOperationExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*BinaryOperationExpr) Restore Uses

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

Restore implements Node interface.

func (*BinaryOperationExpr) SetFlag Uses

func (en *BinaryOperationExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*BinaryOperationExpr) SetType Uses

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

SetType implements ExprNode interface.

type BinlogStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*BinlogStmt) Restore Uses

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

Restore implements Node interface.

type BoundType Uses

type BoundType int

FrameType is the type of window function frame bound.

type ByItem Uses

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

ByItem represents an item in order by or group by.

func (*ByItem) Accept Uses

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

Accept implements Node Accept interface.

func (*ByItem) Restore Uses

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

Restore implements Node interface.

func (*ByItem) SetText Uses

func (n *ByItem) SetText(text string)

SetText implements Node interface.

func (*ByItem) Text Uses

func (n *ByItem) Text() string

Text implements Node interface.

type CaseExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*CaseExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*CaseExpr) GetFlag Uses

func (en *CaseExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*CaseExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*CaseExpr) Restore Uses

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

Restore implements Node interface.

func (*CaseExpr) SetFlag Uses

func (en *CaseExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*CaseExpr) SetType Uses

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

SetType implements ExprNode interface.

type CastFunctionType Uses

type CastFunctionType int

CastFunctionType is the type for cast function.

const (
    CastFunction CastFunctionType = iota + 1
    CastConvertFunction
    CastBinaryOperator
)

CastFunction types

type ChangeStmt Uses

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

func (*ChangeStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*ChangeStmt) Restore Uses

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

Restore implements Node interface.

func (*ChangeStmt) SecureText Uses

func (n *ChangeStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type CharsetOpt Uses

type CharsetOpt struct {
    Chs string
    Col string
}

CharsetOpt is used for parsing charset option from SQL.

type CleanupTableLockStmt Uses

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

CleanupTableLockStmt is a statement to cleanup table lock.

func (*CleanupTableLockStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*CleanupTableLockStmt) Restore Uses

func (n *CleanupTableLockStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type ColumnDef Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ColumnDef) Restore Uses

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

Restore implements Node interface.

func (*ColumnDef) SetText Uses

func (n *ColumnDef) SetText(text string)

SetText implements Node interface.

func (*ColumnDef) Text Uses

func (n *ColumnDef) Text() string

Text implements Node interface.

func (*ColumnDef) Validate Uses

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 Uses

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

ColumnName represents column name.

func (*ColumnName) Accept Uses

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

Accept implements Node Accept interface.

func (*ColumnName) OrigColName Uses

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

OrigColName returns the full original column name.

func (*ColumnName) Restore Uses

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

Restore implements Node interface.

func (*ColumnName) SetText Uses

func (n *ColumnName) SetText(text string)

SetText implements Node interface.

func (*ColumnName) String Uses

func (n *ColumnName) String() string

String implements Stringer interface.

func (*ColumnName) Text Uses

func (n *ColumnName) Text() string

Text implements Node interface.

type ColumnNameExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ColumnNameExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ColumnNameExpr) GetFlag Uses

func (en *ColumnNameExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*ColumnNameExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*ColumnNameExpr) Restore Uses

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

Restore implements Node interface.

func (*ColumnNameExpr) SetFlag Uses

func (en *ColumnNameExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*ColumnNameExpr) SetType Uses

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

SetType implements ExprNode interface.

type ColumnNameOrUserVar Uses

type ColumnNameOrUserVar struct {
    ColumnName *ColumnName
    UserVar    *VariableExpr
}

type ColumnOption Uses

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

ColumnOption is used for parsing column constraint info from SQL.

func (*ColumnOption) Accept Uses

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

Accept implements Node Accept interface.

func (*ColumnOption) Restore Uses

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

Restore implements Node interface.

func (*ColumnOption) SetText Uses

func (n *ColumnOption) SetText(text string)

SetText implements Node interface.

func (*ColumnOption) Text Uses

func (n *ColumnOption) Text() string

Text implements Node interface.

type ColumnOptionType Uses

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
)

ColumnOption types.

type ColumnPosition Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ColumnPosition) Restore Uses

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

Restore implements Node interface.

func (*ColumnPosition) SetText Uses

func (n *ColumnPosition) SetText(text string)

SetText implements Node interface.

func (*ColumnPosition) Text Uses

func (n *ColumnPosition) Text() string

Text implements Node interface.

type ColumnPositionType Uses

type ColumnPositionType int

ColumnPositionType is the type for ColumnPosition.

const (
    ColumnPositionNone ColumnPositionType = iota
    ColumnPositionFirst
    ColumnPositionAfter
)

ColumnPosition Types

type CommitStmt Uses

type CommitStmt struct {
    // 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 Uses

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

Accept implements Node Accept interface.

func (*CommitStmt) Restore Uses

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

Restore implements Node interface.

type CompareSubqueryExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*CompareSubqueryExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*CompareSubqueryExpr) GetFlag Uses

func (en *CompareSubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*CompareSubqueryExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*CompareSubqueryExpr) Restore Uses

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

Restore implements Node interface.

func (*CompareSubqueryExpr) SetFlag Uses

func (en *CompareSubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*CompareSubqueryExpr) SetType Uses

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

SetType implements ExprNode interface.

type Constraint Uses

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 []*IndexColName // 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
    // contains filtered or unexported fields
}

Constraint is constraint for table definition.

func (*Constraint) Accept Uses

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

Accept implements Node Accept interface.

func (*Constraint) Restore Uses

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

Restore implements Node interface.

func (*Constraint) SetText Uses

func (n *Constraint) SetText(text string)

SetText implements Node interface.

func (*Constraint) Text Uses

func (n *Constraint) Text() string

Text implements Node interface.

type ConstraintType Uses

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 Uses

type CreateBindingStmt struct {
    GlobalScope bool
    OriginSel   StmtNode
    HintedSel   StmtNode
    // contains filtered or unexported fields
}

CreateBindingStmt creates sql binding hint.

func (*CreateBindingStmt) Accept Uses

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

func (*CreateBindingStmt) Restore Uses

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

type CreateDatabaseStmt Uses

type CreateDatabaseStmt struct {
    IfNotExists bool
    Name        string
    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 Uses

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

Accept implements Node Accept interface.

func (*CreateDatabaseStmt) Restore Uses

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

Restore implements Node interface.

type CreateIndexStmt Uses

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
    IndexColNames []*IndexColName
    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 Uses

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

Accept implements Node Accept interface.

func (*CreateIndexStmt) Restore Uses

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

Restore implements Node interface.

type CreateTableStmt Uses

type CreateTableStmt struct {
    IfNotExists bool
    IsTemporary 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 Uses

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

Accept implements Node Accept interface.

func (*CreateTableStmt) Restore Uses

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

Restore implements Node interface.

type CreateUserStmt Uses

type CreateUserStmt struct {
    IsCreateRole          bool
    IfNotExists           bool
    Specs                 []*UserSpec
    TslOptions            []*TslOption
    ResourceOptions       []*ResourceOption
    PasswordOrLockOptions []*PasswordOrLockOption
    // contains filtered or unexported fields
}

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

func (*CreateUserStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*CreateUserStmt) Restore Uses

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

Restore implements Node interface.

func (*CreateUserStmt) SecureText Uses

func (n *CreateUserStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type CreateViewStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*CreateViewStmt) Restore Uses

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

Restore implements Node interface.

type DDLNode Uses

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

DDLNode represents DDL statement node.

type DMLNode Uses

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

DMLNode represents DML statement node.

type DatabaseOption Uses

type DatabaseOption struct {
    Tp    DatabaseOptionType
    Value string
}

DatabaseOption represents database option.

func (*DatabaseOption) Restore Uses

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

Restore implements Node interface.

type DatabaseOptionType Uses

type DatabaseOptionType int

DatabaseOptionType is the type for database options.

const (
    DatabaseOptionNone DatabaseOptionType = iota
    DatabaseOptionCharset
    DatabaseOptionCollate
    DatabaseOptionEncryption
)

Database option types.

type DateArithType Uses

type DateArithType byte

DateArithType is type for DateArith type.

const (
    // DateArithAdd is to run adddate or date_add function option.
    // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_adddate
    // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-add
    DateArithAdd DateArithType = iota + 1
    // DateArithSub is to run subdate or date_sub function option.
    // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_subdate
    // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-sub
    DateArithSub
)

type DeallocateStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*DeallocateStmt) Restore Uses

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

Restore implements Node interface.

type DefaultExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*DefaultExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*DefaultExpr) GetFlag Uses

func (en *DefaultExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*DefaultExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*DefaultExpr) Restore Uses

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

Restore implements Node interface.

func (*DefaultExpr) SetFlag Uses

func (en *DefaultExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*DefaultExpr) SetType Uses

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

SetType implements ExprNode interface.

type DeleteStmt Uses

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

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

Accept implements Node Accept interface.

func (*DeleteStmt) Restore Uses

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

Restore implements Node interface.

type DeleteTableList Uses

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

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

func (*DeleteTableList) Accept Uses

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

Accept implements Node Accept interface.

func (*DeleteTableList) Restore Uses

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

Restore implements Node interface.

func (*DeleteTableList) SetText Uses

func (n *DeleteTableList) SetText(text string)

SetText implements Node interface.

func (*DeleteTableList) Text Uses

func (n *DeleteTableList) Text() string

Text implements Node interface.

type DoStmt Uses

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

DoStmt is the struct for DO statement.

func (*DoStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*DoStmt) Restore Uses

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

Restore implements Node interface.

type DropBindingStmt Uses

type DropBindingStmt struct {
    GlobalScope bool
    OriginSel   StmtNode
    HintedSel   StmtNode
    // contains filtered or unexported fields
}

DropBindingStmt deletes sql binding hint.

func (*DropBindingStmt) Accept Uses

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

func (*DropBindingStmt) Restore Uses

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

type DropDatabaseStmt Uses

type DropDatabaseStmt struct {
    IfExists bool
    Name     string
    // 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 Uses

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

Accept implements Node Accept interface.

func (*DropDatabaseStmt) Restore Uses

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

Restore implements Node interface.

type DropIndexStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*DropIndexStmt) Restore Uses

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

Restore implements Node interface.

type DropStatsStmt Uses

type DropStatsStmt struct {
    Table *TableName
    // contains filtered or unexported fields
}

DropStatsStmt is used to drop table statistics.

func (*DropStatsStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*DropStatsStmt) Restore Uses

func (n *DropStatsStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type DropTableStmt Uses

type DropTableStmt struct {
    IfExists    bool
    Tables      []*TableName
    IsView      bool
    IsTemporary bool // 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 Uses

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

Accept implements Node Accept interface.

func (*DropTableStmt) Restore Uses

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

Restore implements Node interface.

type DropUserStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*DropUserStmt) Restore Uses

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

Restore implements Node interface.

type ExecuteStmt Uses

type ExecuteStmt struct {
    Name       string
    UsingVars  []ExprNode
    BinaryArgs interface{}
    ExecID     uint32
    IdxInMulti int
    // 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 Uses

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

Accept implements Node Accept interface.

func (*ExecuteStmt) Restore Uses

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

Restore implements Node interface.

type ExistsSubqueryExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ExistsSubqueryExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ExistsSubqueryExpr) GetFlag Uses

func (en *ExistsSubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*ExistsSubqueryExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*ExistsSubqueryExpr) Restore Uses

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

Restore implements Node interface.

func (*ExistsSubqueryExpr) SetFlag Uses

func (en *ExistsSubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*ExistsSubqueryExpr) SetType Uses

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

SetType implements ExprNode interface.

type ExplainForStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ExplainForStmt) Restore Uses

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

Restore implements Node interface.

type ExplainStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ExplainStmt) Restore Uses

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

Restore implements Node interface.

type ExprNode Uses

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 Uses

type FieldItem struct {
    Type  int
    Value string
}

type FieldList Uses

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

FieldList represents field list in select statement.

func (*FieldList) Accept Uses

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

Accept implements Node Accept interface.

func (*FieldList) Restore Uses

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

Restore implements Node interface.

func (*FieldList) SetText Uses

func (n *FieldList) SetText(text string)

SetText implements Node interface.

func (*FieldList) Text Uses

func (n *FieldList) Text() string

Text implements Node interface.

type FieldsClause Uses

type FieldsClause struct {
    Terminated string
    Enclosed   byte
    Escaped    byte
}

FieldsClause represents fields references clause in load data statement.

func (*FieldsClause) Restore Uses

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

Restore for FieldsClause

type FloatOpt Uses

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 Uses

type FlushStmt struct {
    Tp              FlushStmtType // Privileges/Tables/...
    NoWriteToBinLog bool
    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 Uses

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

Accept implements Node Accept interface.

func (*FlushStmt) Restore Uses

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

Restore implements Node interface.

type FlushStmtType Uses

type FlushStmtType int

FlushStmtType is the type for FLUSH statement.

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

Flush statement types.

type FrameBound Uses

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 Uses

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

Accept implements Node Accept interface.

func (*FrameBound) Restore Uses

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

Restore implements Node interface.

func (*FrameBound) SetText Uses

func (n *FrameBound) SetText(text string)

SetText implements Node interface.

func (*FrameBound) Text Uses

func (n *FrameBound) Text() string

Text implements Node interface.

type FrameClause Uses

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

FrameClause represents frame clause.

func (*FrameClause) Accept Uses

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

Accept implements Node Accept interface.

func (*FrameClause) Restore Uses

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

Restore implements Node interface.

func (*FrameClause) SetText Uses

func (n *FrameClause) SetText(text string)

SetText implements Node interface.

func (*FrameClause) Text Uses

func (n *FrameClause) Text() string

Text implements Node interface.

type FrameExtent Uses

type FrameExtent struct {
    Start FrameBound
    End   FrameBound
}

FrameExtent represents frame extent.

type FrameType Uses

type FrameType int

FrameType is the type of window function frame.

type FulltextSearchModifier Uses

type FulltextSearchModifier int

func (FulltextSearchModifier) IsBooleanMode Uses

func (m FulltextSearchModifier) IsBooleanMode() bool

func (FulltextSearchModifier) IsNaturalLanguageMode Uses

func (m FulltextSearchModifier) IsNaturalLanguageMode() bool

func (FulltextSearchModifier) WithQueryExpansion Uses

func (m FulltextSearchModifier) WithQueryExpansion() bool

type FuncCallExpr Uses

type FuncCallExpr struct {

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

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

Accept implements Node interface.

func (*FuncCallExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*FuncCallExpr) Restore Uses

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

Restore implements Node interface.

type FuncCastExpr Uses

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

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

Accept implements Node Accept interface.

func (*FuncCastExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*FuncCastExpr) Restore Uses

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

Restore implements Node interface.

type FuncNode Uses

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

FuncNode represents function call expression node.

type GetFormatSelectorExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*GetFormatSelectorExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*GetFormatSelectorExpr) GetFlag Uses

func (en *GetFormatSelectorExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*GetFormatSelectorExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*GetFormatSelectorExpr) Restore Uses

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

Restore implements Node interface.

func (*GetFormatSelectorExpr) SetFlag Uses

func (en *GetFormatSelectorExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*GetFormatSelectorExpr) SetType Uses

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

SetType implements ExprNode interface.

type GetFormatSelectorType Uses

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 Uses

func (selector GetFormatSelectorType) String() string

String implements fmt.Stringer interface.

type GrantLevel Uses

type GrantLevel struct {
    Level     GrantLevelType
    DBName    string
    TableName string
}

GrantLevel is used for store the privilege scope.

func (*GrantLevel) Restore Uses

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

Restore implements Node interface.

type GrantLevelType Uses

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 GrantRoleStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*GrantRoleStmt) Restore Uses

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

Restore implements Node interface.

func (*GrantRoleStmt) SecureText Uses

func (n *GrantRoleStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type GrantStmt Uses

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

GrantStmt is the struct for GRANT statement.

func (*GrantStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*GrantStmt) Restore Uses

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

Restore implements Node interface.

func (*GrantStmt) SecureText Uses

func (n *GrantStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type GroupByClause Uses

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

GroupByClause represents group by clause.

func (*GroupByClause) Accept Uses

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

Accept implements Node Accept interface.

func (*GroupByClause) Restore Uses

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

Restore implements Node interface.

func (*GroupByClause) SetText Uses

func (n *GroupByClause) SetText(text string)

SetText implements Node interface.

func (*GroupByClause) Text Uses

func (n *GroupByClause) Text() string

Text implements Node interface.

type HandleRange Uses

type HandleRange struct {
    Begin int64
    End   int64
}

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

type HavingClause Uses

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

HavingClause represents having clause.

func (*HavingClause) Accept Uses

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

Accept implements Node Accept interface.

func (*HavingClause) Restore Uses

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

Restore implements Node interface.

func (*HavingClause) SetText Uses

func (n *HavingClause) SetText(text string)

SetText implements Node interface.

func (*HavingClause) Text Uses

func (n *HavingClause) Text() string

Text implements Node interface.

type HintTable Uses

type HintTable struct {
    DBName    model.CIStr
    TableName model.CIStr
    QBName    model.CIStr
}

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

func (*HintTable) Restore Uses

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

type Ident Uses

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

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

func (Ident) String Uses

func (i Ident) String() string

String implements fmt.Stringer interface.

type IndexColName Uses

type IndexColName struct {
    Column *ColumnName
    Length int
    // contains filtered or unexported fields
}

IndexColName is used for parsing index column name from SQL.

func (*IndexColName) Accept Uses

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

Accept implements Node Accept interface.

func (*IndexColName) Restore Uses

func (n *IndexColName) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*IndexColName) SetText Uses

func (n *IndexColName) SetText(text string)

SetText implements Node interface.

func (*IndexColName) Text Uses

func (n *IndexColName) Text() string

Text implements Node interface.

type IndexHint Uses

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 Uses

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

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

type IndexHintScope Uses

type IndexHintScope int

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

const (
    HintForScan    IndexHintScope = 1
    HintForJoin    IndexHintScope = 2
    HintForOrderBy IndexHintScope = 3
    HintForGroupBy IndexHintScope = 4
)

Index hint scopes.

type IndexHintType Uses

type IndexHintType int

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

const (
    HintUse    IndexHintType = 1
    HintIgnore IndexHintType = 2
    HintForce  IndexHintType = 3
)

IndexHintUseType values.

type IndexKeyType Uses

type IndexKeyType int

IndexKeyType is the type for index key.

const (
    IndexKeyTypeNone IndexKeyType = iota
    IndexKeyTypeUnique
    IndexKeyTypeSpatial
    IndexKeyTypeFullText
)

Index key types.

type IndexLockAndAlgorithm Uses

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

IndexLockAndAlgorithm stores the algorithm option and the lock option.

func (*IndexLockAndAlgorithm) Accept Uses

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

Accept implements Node Accept interface.

func (*IndexLockAndAlgorithm) Restore Uses

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

Restore implements Node interface.

func (*IndexLockAndAlgorithm) SetText Uses

func (n *IndexLockAndAlgorithm) SetText(text string)

SetText implements Node interface.

func (*IndexLockAndAlgorithm) Text Uses

func (n *IndexLockAndAlgorithm) Text() string

Text implements Node interface.

type IndexOption Uses

type IndexOption struct {
    KeyBlockSize uint64
    Tp           model.IndexType
    Comment      string
    ParserName   model.CIStr
    Visibility   IndexVisibility
    // 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 Uses

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

Accept implements Node Accept interface.

func (*IndexOption) Restore Uses

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

Restore implements Node interface.

func (*IndexOption) SetText Uses

func (n *IndexOption) SetText(text string)

SetText implements Node interface.

func (*IndexOption) Text Uses

func (n *IndexOption) Text() string

Text implements Node interface.

type IndexVisibility Uses

type IndexVisibility int

IndexVisibility is the option for index visibility.

const (
    IndexVisibilityDefault IndexVisibility = iota
    IndexVisibilityVisible
    IndexVisibilityInvisible
)

IndexVisibility options.

type InsertStmt Uses

type InsertStmt struct {
    IsReplace   bool
    IgnoreErr   bool
    Table       *TableRefsClause
    Columns     []*ColumnName
    Lists       [][]ExprNode
    Setlist     []*Assignment
    Priority    mysql.PriorityEnum
    OnDuplicate []*Assignment
    Select      ResultSetNode
    // 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 Uses

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

Accept implements Node Accept interface.

func (*InsertStmt) Restore Uses

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

Restore implements Node interface.

type IsNullExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*IsNullExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*IsNullExpr) GetFlag Uses

func (en *IsNullExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*IsNullExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*IsNullExpr) Restore Uses

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

Restore implements Node interface.

func (*IsNullExpr) SetFlag Uses

func (en *IsNullExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*IsNullExpr) SetType Uses

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

SetType implements ExprNode interface.

type IsTruthExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*IsTruthExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*IsTruthExpr) GetFlag Uses

func (en *IsTruthExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*IsTruthExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*IsTruthExpr) Restore Uses

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

Restore implements Node interface.

func (*IsTruthExpr) SetFlag Uses

func (en *IsTruthExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*IsTruthExpr) SetType Uses

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

SetType implements ExprNode interface.

type Join Uses

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

Join represents table join.

func (*Join) Accept Uses

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

Accept implements Node Accept interface.

func (*Join) Restore Uses

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

Restore implements Node interface.

func (*Join) SetText Uses

func (n *Join) SetText(text string)

SetText implements Node interface.

func (*Join) Text Uses

func (n *Join) Text() string

Text implements Node interface.

type JoinType Uses

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 Uses

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

KillStmt is a statement to kill a query or connection.

func (*KillStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*KillStmt) Restore Uses

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

Restore implements Node interface.

type Limit Uses

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

Limit is the limit clause.

func (*Limit) Accept Uses

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

Accept implements Node Accept interface.

func (*Limit) Restore Uses

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

Restore implements Node interface.

func (*Limit) SetText Uses

func (n *Limit) SetText(text string)

SetText implements Node interface.

func (*Limit) Text Uses

func (n *Limit) Text() string

Text implements Node interface.

type LinesClause Uses

type LinesClause struct {
    Starting   string
    Terminated string
}

LinesClause represents lines references clause in load data statement.

func (*LinesClause) Restore Uses

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

Restore for LinesClause

type LoadDataStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*LoadDataStmt) Restore Uses

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

Restore implements Node interface.

type LoadStatsStmt Uses

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

LoadStatsStmt is the statement node for loading statistic.

func (*LoadStatsStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*LoadStatsStmt) Restore Uses

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

Restore implements Node interface.

type LockTablesStmt Uses

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

LockTablesStmt is a statement to lock tables.

func (*LockTablesStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*LockTablesStmt) Restore Uses

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

Restore implements Node interface.

type LockType Uses

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 Uses

func (n LockType) String() string

type MatchAgainst Uses

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 Uses

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

func (*MatchAgainst) Format Uses

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

func (*MatchAgainst) GetFlag Uses

func (en *MatchAgainst) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*MatchAgainst) GetType Uses

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

GetType implements ExprNode interface.

func (*MatchAgainst) Restore Uses

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

func (*MatchAgainst) SetFlag Uses

func (en *MatchAgainst) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*MatchAgainst) SetType Uses

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

SetType implements ExprNode interface.

type MatchType Uses

type MatchType int

MatchType is the type for reference match type.

const (
    MatchNone MatchType = iota
    MatchFull
    MatchPartial
    MatchSimple
)

match type

type MaxValueExpr Uses

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

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

func (*MaxValueExpr) Accept Uses

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

Accept implements Node Accept interface.

func (*MaxValueExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*MaxValueExpr) GetFlag Uses

func (en *MaxValueExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*MaxValueExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*MaxValueExpr) Restore Uses

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

Restore implements Node interface.

func (*MaxValueExpr) SetFlag Uses

func (en *MaxValueExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*MaxValueExpr) SetType Uses

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

SetType implements ExprNode interface.

type Node Uses

type Node interface {
    // Restore returns the sql text from ast tree
    Restore(ctx *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 original text of the element.
    Text() string
    // SetText sets original text to the Node.
    SetText(text string)
}

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

type ObjectTypeType Uses

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
)

func (ObjectTypeType) Restore Uses

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

Restore implements Node interface.

type OnCondition Uses

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

OnCondition represents JOIN on condition.

func (*OnCondition) Accept Uses

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

Accept implements Node Accept interface.

func (*OnCondition) Restore Uses

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

Restore implements Node interface.

func (*OnCondition) SetText Uses

func (n *OnCondition) SetText(text string)

SetText implements Node interface.

func (*OnCondition) Text Uses

func (n *OnCondition) Text() string

Text implements Node interface.

type OnDeleteOpt Uses

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

OnDeleteOpt is used for optional on delete clause.

func (*OnDeleteOpt) Accept Uses

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

Accept implements Node Accept interface.

func (*OnDeleteOpt) Restore Uses

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

Restore implements Node interface.

func (*OnDeleteOpt) SetText Uses

func (n *OnDeleteOpt) SetText(text string)

SetText implements Node interface.

func (*OnDeleteOpt) Text Uses

func (n *OnDeleteOpt) Text() string

Text implements Node interface.

type OnDuplicateKeyHandlingType Uses

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 Uses

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

OnUpdateOpt is used for optional on update clause.

func (*OnUpdateOpt) Accept Uses

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

Accept implements Node Accept interface.

func (*OnUpdateOpt) Restore Uses

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

Restore implements Node interface.

func (*OnUpdateOpt) SetText Uses

func (n *OnUpdateOpt) SetText(text string)

SetText implements Node interface.

func (*OnUpdateOpt) Text Uses

func (n *OnUpdateOpt) Text() string

Text implements Node interface.

type OptBinary Uses

type OptBinary struct {
    IsBinary bool
    Charset  string
}

OptBinary is used for parser.

type OrderByClause Uses

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

OrderByClause represents order by clause.

func (*OrderByClause) Accept Uses

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

Accept implements Node Accept interface.

func (*OrderByClause) Restore Uses

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

Restore implements Node interface.

func (*OrderByClause) SetText Uses

func (n *OrderByClause) SetText(text string)

SetText implements Node interface.

func (*OrderByClause) Text Uses

func (n *OrderByClause) Text() string

Text implements Node interface.

type ParamMarkerExpr Uses

type ParamMarkerExpr interface {
    ValueExpr
    SetOrder(int)
}

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

type ParenthesesExpr Uses

type ParenthesesExpr struct {

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

ParenthesesExpr is the parentheses expression.

func (*ParenthesesExpr) Accept Uses

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

Accept implements Node Accept interface.

func (*ParenthesesExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ParenthesesExpr) GetFlag Uses

func (en *ParenthesesExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*ParenthesesExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*ParenthesesExpr) Restore Uses

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

Restore implements Node interface.

func (*ParenthesesExpr) SetFlag Uses

func (en *ParenthesesExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*ParenthesesExpr) SetType Uses

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

SetType implements ExprNode interface.

type PartitionByClause Uses

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

PartitionByClause represents partition by clause.

func (*PartitionByClause) Accept Uses

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

Accept implements Node Accept interface.

func (*PartitionByClause) Restore Uses

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

Restore implements Node interface.

func (*PartitionByClause) SetText Uses

func (n *PartitionByClause) SetText(text string)

SetText implements Node interface.

func (*PartitionByClause) Text Uses

func (n *PartitionByClause) Text() string

Text implements Node interface.

type PartitionDefinition Uses

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

PartitionDefinition defines a single partition.

func (*PartitionDefinition) Comment Uses

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 Uses

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

Restore implements Node interface.

type PartitionDefinitionClause Uses

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 Uses

type PartitionDefinitionClauseHistory struct {
    Current bool
}

func (*PartitionDefinitionClauseHistory) Validate Uses

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

type PartitionDefinitionClauseIn Uses

type PartitionDefinitionClauseIn struct {
    Values [][]ExprNode
}

func (*PartitionDefinitionClauseIn) Validate Uses

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

type PartitionDefinitionClauseLessThan Uses

type PartitionDefinitionClauseLessThan struct {
    Exprs []ExprNode
}

func (*PartitionDefinitionClauseLessThan) Validate Uses

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

type PartitionDefinitionClauseNone Uses

type PartitionDefinitionClauseNone struct{}

func (*PartitionDefinitionClauseNone) Validate Uses

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

type PartitionMethod Uses

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, LIST and
    // SYSTEM_TIME 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
}

PartitionMethod describes how partitions or subpartitions are constructed.

func (*PartitionMethod) Restore Uses

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

Restore implements the Node interface

type PartitionOptions Uses

type PartitionOptions struct {
    PartitionMethod
    Sub         *PartitionMethod
    Definitions []*PartitionDefinition
    // contains filtered or unexported fields
}

PartitionOptions specifies the partition options.

func (*PartitionOptions) Accept Uses

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

func (*PartitionOptions) Restore Uses

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

func (*PartitionOptions) SetText Uses

func (n *PartitionOptions) SetText(text string)

SetText implements Node interface.

func (*PartitionOptions) Text Uses

func (n *PartitionOptions) Text() string

Text implements Node interface.

func (*PartitionOptions) Validate Uses

func (n *PartitionOptions) Validate() error

Validate checks if the partition is well-formed.

type PasswordOrLockOption Uses

type PasswordOrLockOption struct {
    Type  int
    Count int64
}

func (*PasswordOrLockOption) Restore Uses

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

type PatternInExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*PatternInExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*PatternInExpr) GetFlag Uses

func (en *PatternInExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*PatternInExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*PatternInExpr) Restore Uses

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

Restore implements Node interface.

func (*PatternInExpr) SetFlag Uses

func (en *PatternInExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*PatternInExpr) SetType Uses

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

SetType implements ExprNode interface.

type PatternLikeExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*PatternLikeExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*PatternLikeExpr) GetFlag Uses

func (en *PatternLikeExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*PatternLikeExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*PatternLikeExpr) Restore Uses

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

Restore implements Node interface.

func (*PatternLikeExpr) SetFlag Uses

func (en *PatternLikeExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*PatternLikeExpr) SetType Uses

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

SetType implements ExprNode interface.

type PatternRegexpExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*PatternRegexpExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*PatternRegexpExpr) GetFlag Uses

func (en *PatternRegexpExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*PatternRegexpExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*PatternRegexpExpr) Restore Uses

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

Restore implements Node interface.

func (*PatternRegexpExpr) SetFlag Uses

func (en *PatternRegexpExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*PatternRegexpExpr) SetType Uses

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

SetType implements ExprNode interface.

type PositionExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*PositionExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*PositionExpr) GetFlag Uses

func (en *PositionExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*PositionExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*PositionExpr) Restore Uses

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

Restore implements Node interface.

func (*PositionExpr) SetFlag Uses

func (en *PositionExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*PositionExpr) SetType Uses

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

SetType implements ExprNode interface.

type PrepareStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*PrepareStmt) Restore Uses

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

Restore implements Node interface.

type Prepared Uses

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

Prepared represents a prepared statement.

type PrivElem Uses

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

PrivElem is the privilege type and optional column list.

func (*PrivElem) Accept Uses

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

Accept implements Node Accept interface.

func (*PrivElem) Restore Uses

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

Restore implements Node interface.

func (*PrivElem) SetText Uses

func (n *PrivElem) SetText(text string)

SetText implements Node interface.

func (*PrivElem) Text Uses

func (n *PrivElem) Text() string

Text implements Node interface.

type RecoverTableStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*RecoverTableStmt) Restore Uses

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

Restore implements Node interface.

type ReferOptionType Uses

type ReferOptionType int

ReferOptionType is the type for refer options.

const (
    ReferOptionNoOption ReferOptionType = iota
    ReferOptionRestrict
    ReferOptionCascade
    ReferOptionSetNull
    ReferOptionNoAction
    ReferOptionSetDefault
)

Refer option types.

func (ReferOptionType) String Uses

func (r ReferOptionType) String() string

String implements fmt.Stringer interface.

type ReferenceDef Uses

type ReferenceDef struct {
    Table         *TableName
    IndexColNames []*IndexColName
    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 Uses

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

Accept implements Node Accept interface.

func (*ReferenceDef) Restore Uses

func (n *ReferenceDef) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*ReferenceDef) SetText Uses

func (n *ReferenceDef) SetText(text string)

SetText implements Node interface.

func (*ReferenceDef) Text Uses

func (n *ReferenceDef) Text() string

Text implements Node interface.

type RenameTableStmt Uses

type RenameTableStmt struct {
    OldTable *TableName
    NewTable *TableName

    // TableToTables is only useful for syncer which depends heavily on tidb parser to do some dirty work for now.
    // TODO: Refactor this when you are going to add full support for multiple schema changes.
    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 Uses

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

Accept implements Node Accept interface.

func (*RenameTableStmt) Restore Uses

func (n *RenameTableStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type RepairTableStmt Uses

type RepairTableStmt struct {
    Table      *TableName
    CreateStmt *CreateTableStmt
    // contains filtered or unexported fields
}

RepairTableStmt is a statement to repair tableInfo.

func (*RepairTableStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*RepairTableStmt) Restore Uses

func (n *RepairTableStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type ResourceOption Uses

type ResourceOption struct {
    Type  int
    Count int64
}

func (*ResourceOption) Restore Uses

func (r *ResourceOption) Restore(ctx *RestoreCtx) error

type ResultField Uses

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 Uses

type ResultSetNode interface {
    Node
}

ResultSetNode interface has a ResultFields property, represents a Node that returns result set. Implementations include SelectStmt, SubqueryExpr, TableSource, TableName and Join.

type RevokeRoleStmt Uses

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

RevokeStmt is the struct for REVOKE statement.

func (*RevokeRoleStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*RevokeRoleStmt) Restore Uses

func (n *RevokeRoleStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type RevokeStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*RevokeStmt) Restore Uses

func (n *RevokeStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type RollbackStmt Uses

type RollbackStmt struct {
    // 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 Uses

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

Accept implements Node Accept interface.

func (*RollbackStmt) Restore Uses

func (n *RollbackStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type RowExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*RowExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*RowExpr) GetFlag Uses

func (en *RowExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*RowExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*RowExpr) Restore Uses

func (n *RowExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*RowExpr) SetFlag Uses

func (en *RowExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*RowExpr) SetType Uses

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

SetType implements ExprNode interface.

type SelectField Uses

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

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

Accept implements Node Accept interface.

func (*SelectField) Restore Uses

func (n *SelectField) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*SelectField) SetText Uses

func (n *SelectField) SetText(text string)

SetText implements Node interface.

func (*SelectField) Text Uses

func (n *SelectField) Text() string

Text implements Node interface.

type SelectLockType Uses

type SelectLockType int

SelectLockType is the lock type for SelectStmt.

const (
    SelectLockNone SelectLockType = iota
    SelectLockForUpdate
    SelectLockInShareMode
    SelectLockForUpdateNoWait
)

Select lock types.

func (SelectLockType) String Uses

func (slt SelectLockType) String() string

String implements fmt.Stringer.

type SelectStmt Uses

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
    // LockTp is the lock type
    LockTp SelectLockType
    // TableHints represents the table level Optimizer Hint for join type
    TableHints []*TableOptimizerHint
    // IsAfterUnionDistinct indicates whether it's a stmt after "union distinct".
    IsAfterUnionDistinct bool
    // IsInBraces indicates whether it's a stmt in brace.
    IsInBraces bool
    // QueryBlockOffset indicates the order of this SelectStmt if counted from left to right in the sql text.
    QueryBlockOffset int
    // 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 Uses

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

Accept implements Node Accept interface.

func (*SelectStmt) Restore Uses

func (n *SelectStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type SelectStmtOpts Uses

type SelectStmtOpts struct {
    Distinct        bool
    SQLBigResult    bool
    SQLBufferResult bool
    SQLCache        bool
    SQLSmallResult  bool
    CalcFoundRows   bool
    StraightJoin    bool
    Priority        mysql.PriorityEnum
    TableHints      []*TableOptimizerHint
}

SelectStmtOpts wrap around select hints and switches

type SensitiveStmtNode Uses

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 SetDefaultRoleStmt Uses

type SetDefaultRoleStmt struct {
    SetRoleOpt SetRoleStmtType
    RoleList   []*auth.RoleIdentity
    UserList   []*auth.UserIdentity
    // contains filtered or unexported fields
}

func (*SetDefaultRoleStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*SetDefaultRoleStmt) Restore Uses

func (n *SetDefaultRoleStmt) Restore(ctx *RestoreCtx) error

type SetPwdStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*SetPwdStmt) Restore Uses

func (n *SetPwdStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*SetPwdStmt) SecureText Uses

func (n *SetPwdStmt) SecureText() string

SecureText implements SensitiveStatement interface.

type SetRoleStmt Uses

type SetRoleStmt struct {
    SetRoleOpt SetRoleStmtType
    RoleList   []*auth.RoleIdentity
    // contains filtered or unexported fields
}

func (*SetRoleStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*SetRoleStmt) Restore Uses

func (n *SetRoleStmt) Restore(ctx *RestoreCtx) error

type SetRoleStmtType Uses

type SetRoleStmtType int

SetRoleStmtType is the type for FLUSH statement.

const (
    SetRoleDefault SetRoleStmtType = iota
    SetRoleNone
    SetRoleAll
    SetRoleAllExcept
    SetRoleRegular
)

SetRole statement types.

type SetStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*SetStmt) Restore Uses

func (n *SetStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type ShowSlow Uses

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 Uses

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

Restore implements Node interface.

type ShowSlowKind Uses

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 Uses

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 Uses

type ShowStmt struct {
    Tp          ShowStmtType // Databases/Tables/Columns/....
    DBName      string
    Table       *TableName  // Used for showing columns.
    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`

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

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

Accept implements Node Accept interface.

func (*ShowStmt) Restore Uses

func (n *ShowStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type ShowStmtType Uses

type ShowStmtType int

ShowStmtType is the type for SHOW statement.

type ShutdownStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ShutdownStmt) Restore Uses

func (n *ShutdownStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type SplitOption Uses

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

func (*SplitOption) Restore Uses

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

type SplitRegionStmt Uses

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

    SplitSyntaxOpt *SplitSyntaxOption

    SplitOpt *SplitOption
    // contains filtered or unexported fields
}

func (*SplitRegionStmt) Accept Uses

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

func (*SplitRegionStmt) Restore Uses

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

type SplitSyntaxOption Uses

type SplitSyntaxOption struct {
    HasRegionFor bool
    HasPartition bool
}

type StmtNode Uses

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

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

type SubPartitionDefinition Uses

type SubPartitionDefinition struct {
    Name    model.CIStr
    Options []*TableOption
}

func (*SubPartitionDefinition) Restore Uses

func (spd *SubPartitionDefinition) Restore(ctx *RestoreCtx) error

type SubqueryExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*SubqueryExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*SubqueryExpr) GetFlag Uses

func (en *SubqueryExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*SubqueryExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*SubqueryExpr) Restore Uses

func (n *SubqueryExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*SubqueryExpr) SetFlag Uses

func (en *SubqueryExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*SubqueryExpr) SetType Uses

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

SetType implements ExprNode interface.

type TableLock Uses

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

TableLock contains the table name and lock type.

type TableName Uses

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

    DBInfo    *model.DBInfo
    TableInfo *model.TableInfo

    IndexHints     []*IndexHint
    PartitionNames []model.CIStr
    // contains filtered or unexported fields
}

TableName represents a table name.

func (*TableName) Accept Uses

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

Accept implements Node Accept interface.

func (*TableName) Restore Uses

func (n *TableName) Restore(ctx *RestoreCtx) error

func (*TableName) SetText Uses

func (n *TableName) SetText(text string)

SetText implements Node interface.

func (*TableName) Text Uses

func (n *TableName) Text() string

Text implements Node interface.

type TableOptimizerHint Uses

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
    // QBName is the default effective query block of this hint.
    QBName    model.CIStr
    Tables    []HintTable
    Indexes   []model.CIStr
    StoreType model.CIStr
    // Statement Execution Time Optimizer Hints
    // See https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html#optimizer-hints-execution-time
    MaxExecutionTime uint64
    MemoryQuota      int64
    QueryType        model.CIStr
    HintFlag         bool
    // contains filtered or unexported fields
}

TableOptimizerHint is Table level optimizer hint

func (*TableOptimizerHint) Accept Uses

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

Accept implements Node Accept interface.

func (*TableOptimizerHint) Restore Uses

func (n *TableOptimizerHint) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TableOptimizerHint) SetText Uses

func (n *TableOptimizerHint) SetText(text string)

SetText implements Node interface.

func (*TableOptimizerHint) Text Uses

func (n *TableOptimizerHint) Text() string

Text implements Node interface.

type TableOption Uses

type TableOption struct {
    Tp         TableOptionType
    Default    bool
    StrValue   string
    UintValue  uint64
    TableNames []*TableName
}

TableOption is used for parsing table option from SQL.

func (*TableOption) Restore Uses

func (n *TableOption) Restore(ctx *RestoreCtx) error

type TableOptionType Uses

type TableOptionType int

TableOptionType is the type for TableOption

const (
    TableOptionNone TableOptionType = iota
    TableOptionEngine
    TableOptionCharset
    TableOptionCollate
    TableOptionAutoIncrement
    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
)

TableOption types.

type TableRefsClause Uses

type TableRefsClause struct {
    TableRefs *Join
    // contains filtered or unexported fields
}

TableRefsClause represents table references clause in dml statement.

func (*TableRefsClause) Accept Uses

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

Accept implements Node Accept interface.

func (*TableRefsClause) Restore Uses

func (n *TableRefsClause) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TableRefsClause) SetText Uses

func (n *TableRefsClause) SetText(text string)

SetText implements Node interface.

func (*TableRefsClause) Text Uses

func (n *TableRefsClause) Text() string

Text implements Node interface.

type TableSource Uses

type TableSource struct {

    // Source is the source of the data, can be a TableName,
    // a SelectStmt, a UnionStmt, 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 Uses

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

Accept implements Node Accept interface.

func (*TableSource) Restore Uses

func (n *TableSource) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TableSource) SetText Uses

func (n *TableSource) SetText(text string)

SetText implements Node interface.

func (*TableSource) Text Uses

func (n *TableSource) Text() string

Text implements Node interface.

type TableToTable Uses

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 Uses

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

Accept implements Node Accept interface.

func (*TableToTable) Restore Uses

func (n *TableToTable) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TableToTable) SetText Uses

func (n *TableToTable) SetText(text string)

SetText implements Node interface.

func (*TableToTable) Text Uses

func (n *TableToTable) Text() string

Text implements Node interface.

type TexprNode Uses

type TexprNode = exprNode

TexprNode is exported for parser driver.

type TiFlashReplicaSpec Uses

type TiFlashReplicaSpec struct {
    Count  uint64
    Labels []string
}

type TimeUnitExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*TimeUnitExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*TimeUnitExpr) GetFlag Uses

func (en *TimeUnitExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*TimeUnitExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*TimeUnitExpr) Restore Uses

func (n *TimeUnitExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TimeUnitExpr) SetFlag Uses

func (en *TimeUnitExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*TimeUnitExpr) SetType Uses

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

SetType implements ExprNode interface.

type TimeUnitType Uses

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) String Uses

func (unit TimeUnitType) String() string

String implements fmt.Stringer interface.

type TimestampBound Uses

type TimestampBound struct {
    Mode      TimestampBoundMode
    Timestamp ExprNode
}

type TimestampBoundMode Uses

type TimestampBoundMode int
const (
    TimestampBoundStrong TimestampBoundMode = iota
    TimestampBoundMaxStaleness
    TimestampBoundExactStaleness
    TimestampBoundReadTimestamp
    TimestampBoundMinReadTimestamp
)

type TraceStmt Uses

type TraceStmt struct {
    Stmt   StmtNode
    Format string
    // contains filtered or unexported fields
}

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

func (*TraceStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*TraceStmt) Restore Uses

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

Restore implements Node interface.

type TrimDirectionExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*TrimDirectionExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*TrimDirectionExpr) GetFlag Uses

func (en *TrimDirectionExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*TrimDirectionExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*TrimDirectionExpr) Restore Uses

func (n *TrimDirectionExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*TrimDirectionExpr) SetFlag Uses

func (en *TrimDirectionExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*TrimDirectionExpr) SetType Uses

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

SetType implements ExprNode interface.

type TrimDirectionType Uses

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 Uses

func (direction TrimDirectionType) String() string

String implements fmt.Stringer interface.

type TruncateTableStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*TruncateTableStmt) Restore Uses

func (n *TruncateTableStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type TslOption Uses

type TslOption struct {
    Type  int
    Value string
}

func (*TslOption) Restore Uses

func (t *TslOption) Restore(ctx *RestoreCtx) error

type TypeOpt Uses

type TypeOpt struct {
    IsUnsigned bool
    IsZerofill bool
}

TypeOpt is used for parsing data type option from SQL.

type UnaryOperationExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*UnaryOperationExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*UnaryOperationExpr) GetFlag Uses

func (en *UnaryOperationExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*UnaryOperationExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*UnaryOperationExpr) Restore Uses

func (n *UnaryOperationExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*UnaryOperationExpr) SetFlag Uses

func (en *UnaryOperationExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*UnaryOperationExpr) SetType Uses

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

SetType implements ExprNode interface.

type UnionSelectList Uses

type UnionSelectList struct {
    Selects []*SelectStmt
    // contains filtered or unexported fields
}

UnionSelectList represents the select list in a union statement.

func (*UnionSelectList) Accept Uses

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

Accept implements Node Accept interface.

func (*UnionSelectList) Restore Uses

func (n *UnionSelectList) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*UnionSelectList) SetText Uses

func (n *UnionSelectList) SetText(text string)

SetText implements Node interface.

func (*UnionSelectList) Text Uses

func (n *UnionSelectList) Text() string

Text implements Node interface.

type UnionStmt Uses

type UnionStmt struct {
    SelectList *UnionSelectList
    OrderBy    *OrderByClause
    Limit      *Limit
    // contains filtered or unexported fields
}

UnionStmt represents "union statement" See https://dev.mysql.com/doc/refman/5.7/en/union.html

func (*UnionStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*UnionStmt) Restore Uses

func (n *UnionStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type UnlockTablesStmt Uses

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

UnlockTablesStmt is a statement to unlock tables.

func (*UnlockTablesStmt) Accept Uses

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

Accept implements Node Accept interface.

func (*UnlockTablesStmt) Restore Uses

func (n *UnlockTablesStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type UpdateStmt Uses

type UpdateStmt struct {
    TableRefs     *TableRefsClause
    List          []*Assignment
    Where         ExprNode
    Order         *OrderByClause
    Limit         *Limit
    Priority      mysql.PriorityEnum
    IgnoreErr     bool
    MultipleTable bool
    TableHints    []*TableOptimizerHint
    // 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 Uses

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

Accept implements Node Accept interface.

func (*UpdateStmt) Restore Uses

func (n *UpdateStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type UseStmt Uses

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 Uses

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

Accept implements Node Accept interface.

func (*UseStmt) Restore Uses

func (n *UseStmt) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

type UserSpec Uses

type UserSpec struct {
    User    *auth.UserIdentity
    AuthOpt *AuthOption
    IsRole  bool
}

UserSpec is used for parsing create user statement.

func (*UserSpec) EncodedPassword Uses

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 Uses

func (n *UserSpec) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*UserSpec) SecurityString Uses

func (n *UserSpec) SecurityString() string

SecurityString formats the UserSpec without password information.

type ValueExpr Uses

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 Uses

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 Uses

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

Accept implements Node Accept interface.

func (*ValuesExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*ValuesExpr) GetFlag Uses

func (en *ValuesExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*ValuesExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*ValuesExpr) Restore Uses

func (n *ValuesExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*ValuesExpr) SetFlag Uses

func (en *ValuesExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*ValuesExpr) SetType Uses

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

SetType implements ExprNode interface.

type VariableAssignment Uses

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 Uses

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

Accept implements Node interface.

func (*VariableAssignment) Restore Uses

func (n *VariableAssignment) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*VariableAssignment) SetText Uses

func (n *VariableAssignment) SetText(text string)

SetText implements Node interface.

func (*VariableAssignment) Text Uses

func (n *VariableAssignment) Text() string

Text implements Node interface.

type VariableExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*VariableExpr) Format Uses

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

Format the ExprNode into a Writer.

func (*VariableExpr) GetFlag Uses

func (en *VariableExpr) GetFlag() uint64

GetFlag implements ExprNode interface.

func (*VariableExpr) GetType Uses

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

GetType implements ExprNode interface.

func (*VariableExpr) Restore Uses

func (n *VariableExpr) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*VariableExpr) SetFlag Uses

func (en *VariableExpr) SetFlag(flag uint64)

SetFlag implements ExprNode interface.

func (*VariableExpr) SetType Uses

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

SetType implements ExprNode interface.

type Visitor Uses

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 Uses

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 Uses

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

Accept implements Node Accept interface.

func (*WhenClause) Restore Uses

func (n *WhenClause) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*WhenClause) SetText Uses

func (n *WhenClause) SetText(text string)

SetText implements Node interface.

func (*WhenClause) Text Uses

func (n *WhenClause) Text() string

Text implements Node interface.

type WildCardField Uses

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 Uses

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

Accept implements Node Accept interface.

func (*WildCardField) Restore Uses

func (n *WildCardField) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*WildCardField) SetText Uses

func (n *WildCardField) SetText(text string)

SetText implements Node interface.

func (*WildCardField) Text Uses

func (n *WildCardField) Text() string

Text implements Node interface.

type WindowFuncExpr Uses

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 Uses

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

Accept implements Node Accept interface.

func (*WindowFuncExpr) Format Uses

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

Format formats the window function expression into a Writer.

func (*WindowFuncExpr) Restore Uses

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

Restore implements Node interface.

type WindowSpec Uses

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 Uses

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

Accept implements Node Accept interface.

func (*WindowSpec) Restore Uses

func (n *WindowSpec) Restore(ctx *RestoreCtx) error

Restore implements Node interface.

func (*WindowSpec) SetText Uses

func (n *WindowSpec) SetText(text string)

SetText implements Node interface.

func (*WindowSpec) Text Uses

func (n *WindowSpec) Text() string

Text implements Node interface.

Package ast imports 14 packages (graph) and is imported by 142 packages. Updated 2019-11-11. Refresh now. Tools for package owners.