Documentation ¶
Index ¶
- Constants
- type AlterTableStmt
- type BeginStmt
- type CommitStmt
- type CreateDatabaseStmt
- func (s *CreateDatabaseStmt) Exec(ctx context.Context) (_ rset.Recordset, err error)
- func (s *CreateDatabaseStmt) Explain(ctx context.Context, w format.Formatter)
- func (s *CreateDatabaseStmt) IsDDL() bool
- func (s *CreateDatabaseStmt) OriginText() string
- func (s *CreateDatabaseStmt) SetText(text string)
- type CreateIndexStmt
- type CreateTableStmt
- type DeallocateStmt
- type DeleteStmt
- type DoStmt
- type DropDatabaseStmt
- type DropIndexStmt
- type DropTableStmt
- type ExecuteStmt
- type ExplainStmt
- type InsertIntoStmt
- type PreparedStmt
- func (s *PreparedStmt) Exec(ctx context.Context) (_ rset.Recordset, err error)
- func (s *PreparedStmt) Explain(ctx context.Context, w format.Formatter)
- func (s *PreparedStmt) GetSQL(ctx context.Context) (string, error)
- func (s *PreparedStmt) IsDDL() bool
- func (s *PreparedStmt) OriginText() string
- func (s *PreparedStmt) SetText(text string)
- type RollbackStmt
- type SelectStmt
- func (s *SelectStmt) Exec(ctx context.Context) (rs rset.Recordset, err error)
- func (s *SelectStmt) Explain(ctx context.Context, w format.Formatter)
- func (s *SelectStmt) IsDDL() bool
- func (s *SelectStmt) OriginText() string
- func (s *SelectStmt) Plan(ctx context.Context) (plan.Plan, error)
- func (s *SelectStmt) SetText(text string)
- type SetCharsetStmt
- type SetPwdStmt
- type SetStmt
- type ShowStmt
- type TruncateTableStmt
- type UnionStmt
- func (s *UnionStmt) Exec(ctx context.Context) (rs rset.Recordset, err error)
- func (s *UnionStmt) Explain(ctx context.Context, w format.Formatter)
- func (s *UnionStmt) IsDDL() bool
- func (s *UnionStmt) OriginText() string
- func (s *UnionStmt) Plan(ctx context.Context) (plan.Plan, error)
- func (s *UnionStmt) SetText(text string)
- type UpdateStmt
- type UseStmt
- type VariableAssignment
Constants ¶
const ( NoPriority = iota LowPriority HighPriority DelayedPriority )
Priority const values. See: https://dev.mysql.com/doc/refman/5.7/en/insert.html
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlterTableStmt ¶
type AlterTableStmt struct { Ident table.Ident Specs []*ddl.AlterSpecification Text string }
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) Explain ¶
func (s *AlterTableStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*AlterTableStmt) IsDDL ¶
func (s *AlterTableStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*AlterTableStmt) OriginText ¶
func (s *AlterTableStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*AlterTableStmt) SetText ¶
func (s *AlterTableStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type BeginStmt ¶
type BeginStmt struct {
Text string
}
BeginStmt is a statement to start a new transaction. See: https://dev.mysql.com/doc/refman/5.7/en/commit.html
func (*BeginStmt) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type CommitStmt ¶
type CommitStmt struct {
Text string
}
CommitStmt is a statement to commit the current transaction. See: https://dev.mysql.com/doc/refman/5.7/en/commit.html
func (*CommitStmt) Explain ¶
func (s *CommitStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*CommitStmt) IsDDL ¶
func (s *CommitStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*CommitStmt) OriginText ¶
func (s *CommitStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*CommitStmt) SetText ¶
func (s *CommitStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type CreateDatabaseStmt ¶
type CreateDatabaseStmt struct { IfNotExists bool Name string Opt *coldef.CharsetOpt Text string }
CreateDatabaseStmt is a statement to create a database. See: https://dev.mysql.com/doc/refman/5.7/en/create-database.html
func (*CreateDatabaseStmt) Explain ¶
func (s *CreateDatabaseStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*CreateDatabaseStmt) IsDDL ¶
func (s *CreateDatabaseStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*CreateDatabaseStmt) OriginText ¶
func (s *CreateDatabaseStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*CreateDatabaseStmt) SetText ¶
func (s *CreateDatabaseStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type CreateIndexStmt ¶
type CreateIndexStmt struct { IndexName string TableIdent table.Ident Unique bool IndexColNames []*coldef.IndexColName Text string }
CreateIndexStmt is a statement to create an index. See: https://dev.mysql.com/doc/refman/5.7/en/create-index.html
func (*CreateIndexStmt) Explain ¶
func (s *CreateIndexStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*CreateIndexStmt) IsDDL ¶
func (s *CreateIndexStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*CreateIndexStmt) OriginText ¶
func (s *CreateIndexStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*CreateIndexStmt) SetText ¶
func (s *CreateIndexStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type CreateTableStmt ¶
type CreateTableStmt struct { IfNotExists bool Ident table.Ident Cols []*coldef.ColumnDef Constraints []*coldef.TableConstraint Opt *coldef.TableOption Text string }
CreateTableStmt is a statement to create a table. See: https://dev.mysql.com/doc/refman/5.7/en/create-table.html
func (*CreateTableStmt) Explain ¶
func (s *CreateTableStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*CreateTableStmt) IsDDL ¶
func (s *CreateTableStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*CreateTableStmt) OriginText ¶
func (s *CreateTableStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*CreateTableStmt) SetText ¶
func (s *CreateTableStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type DeallocateStmt ¶
type DeallocateStmt struct { Name string ID uint32 // For binary protocol, there is no Name but only ID. Text string }
DeallocateStmt is a statement to release PreparedStmt. See: https://dev.mysql.com/doc/refman/5.7/en/deallocate-prepare.html
func (*DeallocateStmt) Explain ¶
func (s *DeallocateStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*DeallocateStmt) IsDDL ¶
func (s *DeallocateStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*DeallocateStmt) OriginText ¶
func (s *DeallocateStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*DeallocateStmt) SetText ¶
func (s *DeallocateStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type DeleteStmt ¶
type DeleteStmt struct { TableIdent table.Ident Where expression.Expression Order *rsets.OrderByRset Limit *rsets.LimitRset LowPriority bool Ignore bool Quick bool MultiTable bool BeforeFrom bool TableIdents []table.Ident Refs *rsets.JoinRset Text string }
DeleteStmt is a statement to delete rows from table. See: https://dev.mysql.com/doc/refman/5.7/en/delete.html
func (*DeleteStmt) Explain ¶
func (s *DeleteStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*DeleteStmt) IsDDL ¶
func (s *DeleteStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*DeleteStmt) OriginText ¶
func (s *DeleteStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*DeleteStmt) SetText ¶
func (s *DeleteStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type DoStmt ¶
type DoStmt struct { Exprs []expression.Expression Text string }
DoStmt is a statement to execute the expressions but not get any results. See: https://dev.mysql.com/doc/refman/5.7/en/do.html
func (*DoStmt) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type DropDatabaseStmt ¶
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) Explain ¶
func (s *DropDatabaseStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*DropDatabaseStmt) IsDDL ¶
func (s *DropDatabaseStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*DropDatabaseStmt) OriginText ¶
func (s *DropDatabaseStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*DropDatabaseStmt) SetText ¶
func (s *DropDatabaseStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type DropIndexStmt ¶
DropIndexStmt is a statement to drop the index. See: https://dev.mysql.com/doc/refman/5.7/en/drop-index.html
func (*DropIndexStmt) Explain ¶
func (s *DropIndexStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*DropIndexStmt) IsDDL ¶
func (s *DropIndexStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*DropIndexStmt) OriginText ¶
func (s *DropIndexStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*DropIndexStmt) SetText ¶
func (s *DropIndexStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type DropTableStmt ¶
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) Explain ¶
func (s *DropTableStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*DropTableStmt) IsDDL ¶
func (s *DropTableStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*DropTableStmt) OriginText ¶
func (s *DropTableStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*DropTableStmt) SetText ¶
func (s *DropTableStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type ExecuteStmt ¶
type ExecuteStmt struct { Name string ID uint32 // For binary protocol, there is no Name but only ID UsingVars []expression.Expression Text string }
ExecuteStmt is a statement to execute PreparedStmt. See: https://dev.mysql.com/doc/refman/5.7/en/execute.html
func (*ExecuteStmt) Explain ¶
func (s *ExecuteStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*ExecuteStmt) IsDDL ¶
func (s *ExecuteStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*ExecuteStmt) OriginText ¶
func (s *ExecuteStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*ExecuteStmt) SetText ¶
func (s *ExecuteStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type ExplainStmt ¶
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) Explain ¶
func (s *ExplainStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*ExplainStmt) IsDDL ¶
func (s *ExplainStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*ExplainStmt) OriginText ¶
func (s *ExplainStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*ExplainStmt) SetText ¶
func (s *ExplainStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type InsertIntoStmt ¶
type InsertIntoStmt struct { ColNames []string Lists [][]expression.Expression Sel *SelectStmt TableIdent table.Ident Setlist []*expressions.Assignment Priority int OnDuplicate []expressions.Assignment Text string }
InsertIntoStmt is a statement to insert new rows into an existing table. See: https://dev.mysql.com/doc/refman/5.7/en/insert.html
func (*InsertIntoStmt) Explain ¶
func (s *InsertIntoStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*InsertIntoStmt) IsDDL ¶
func (s *InsertIntoStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*InsertIntoStmt) OriginText ¶
func (s *InsertIntoStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*InsertIntoStmt) SetText ¶
func (s *InsertIntoStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type PreparedStmt ¶
type PreparedStmt struct { InPrepare bool // true for prepare mode, false for use mode Name string ID uint32 // For binary protocol, there is no Name but only ID SQLText string SQLVar *expressions.Variable SQLStmt stmt.Statement // The parsed statement from sql text with placeholder Params []*expressions.ParamMarker Fields []*field.ResultField Text string }
PreparedStmt 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 (*PreparedStmt) Explain ¶
func (s *PreparedStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*PreparedStmt) GetSQL ¶
func (s *PreparedStmt) GetSQL(ctx context.Context) (string, error)
GetSQL get prepared SQL text.
func (*PreparedStmt) IsDDL ¶
func (s *PreparedStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*PreparedStmt) OriginText ¶
func (s *PreparedStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*PreparedStmt) SetText ¶
func (s *PreparedStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type RollbackStmt ¶
type RollbackStmt struct {
Text string
}
RollbackStmt is a statement to roll back the current transaction. See: https://dev.mysql.com/doc/refman/5.7/en/commit.html
func (*RollbackStmt) Explain ¶
func (s *RollbackStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*RollbackStmt) IsDDL ¶
func (s *RollbackStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*RollbackStmt) OriginText ¶
func (s *RollbackStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*RollbackStmt) SetText ¶
func (s *RollbackStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type SelectStmt ¶
type SelectStmt struct { Distinct bool Fields []*field.Field From *rsets.JoinRset GroupBy *rsets.GroupByRset Having *rsets.HavingRset Limit *rsets.LimitRset Offset *rsets.OffsetRset OrderBy *rsets.OrderByRset Where *rsets.WhereRset // TODO: rename Lock Lock coldef.LockType Text string }
SelectStmt is a statement to retrieve rows selected from one or more tables. See: https://dev.mysql.com/doc/refman/5.7/en/select.html
func (*SelectStmt) Explain ¶
func (s *SelectStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*SelectStmt) IsDDL ¶
func (s *SelectStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*SelectStmt) OriginText ¶
func (s *SelectStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*SelectStmt) Plan ¶
Plan implements the plan.Planner interface. The whole phase for select is `from -> where -> lock -> group by -> having -> select fields -> distinct -> order by -> limit -> final`
func (*SelectStmt) SetText ¶
func (s *SelectStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type SetCharsetStmt ¶
SetCharsetStmt is a statement to assign values to character and collation variables. See: https://dev.mysql.com/doc/refman/5.7/en/set-statement.html
func (*SetCharsetStmt) Explain ¶
func (s *SetCharsetStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*SetCharsetStmt) IsDDL ¶
func (s *SetCharsetStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*SetCharsetStmt) OriginText ¶
func (s *SetCharsetStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*SetCharsetStmt) SetText ¶
func (s *SetCharsetStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type SetPwdStmt ¶
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) Explain ¶
func (s *SetPwdStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*SetPwdStmt) IsDDL ¶
func (s *SetPwdStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*SetPwdStmt) OriginText ¶
func (s *SetPwdStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*SetPwdStmt) SetText ¶
func (s *SetPwdStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type SetStmt ¶
type SetStmt struct { Variables []*VariableAssignment Text string }
SetStmt is a statement to assigns values to different types of variables. See: https://dev.mysql.com/doc/refman/5.7/en/set-statement.html
func (*SetStmt) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type ShowStmt ¶
type ShowStmt struct { Target int // Databases/Tables/Columns/.... DBName string TableIdent table.Ident // Used for showing columns. ColumnName string // Used for `desc table column`. Flag int // Some flag parsed from sql, such as FULL. Full bool Text string }
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) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type TruncateTableStmt ¶
TruncateTableStmt is a statement to empty a table completely. See: https://dev.mysql.com/doc/refman/5.7/en/truncate-table.html
func (*TruncateTableStmt) Explain ¶
func (s *TruncateTableStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*TruncateTableStmt) IsDDL ¶
func (s *TruncateTableStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*TruncateTableStmt) OriginText ¶
func (s *TruncateTableStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*TruncateTableStmt) SetText ¶
func (s *TruncateTableStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type UnionStmt ¶
type UnionStmt struct { Distincts []bool Selects []*SelectStmt Text string }
UnionStmt is a statement to combine results from multiple SelectStmts. See: https://dev.mysql.com/doc/refman/5.7/en/union.html
func (*UnionStmt) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type UpdateStmt ¶
type UpdateStmt struct { TableIdent table.Ident List []expressions.Assignment Where expression.Expression Order *rsets.OrderByRset Limit *rsets.LimitRset LowPriority bool Ignore bool Text string }
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) Explain ¶
func (s *UpdateStmt) Explain(ctx context.Context, w format.Formatter)
Explain implements the stmt.Statement Explain interface.
func (*UpdateStmt) IsDDL ¶
func (s *UpdateStmt) IsDDL() bool
IsDDL implements the stmt.Statement IsDDL interface.
func (*UpdateStmt) OriginText ¶
func (s *UpdateStmt) OriginText() string
OriginText implements the stmt.Statement OriginText interface.
func (*UpdateStmt) SetText ¶
func (s *UpdateStmt) SetText(text string)
SetText implements the stmt.Statement SetText interface.
type UseStmt ¶
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) OriginText ¶
OriginText implements the stmt.Statement OriginText interface.
type VariableAssignment ¶
type VariableAssignment struct { Name string Value expression.Expression IsGlobal bool IsSystem bool Text string }
VariableAssignment is a varible assignment struct.
func (*VariableAssignment) String ¶
func (v *VariableAssignment) String() string
String implements the fmt.Stringer interface.