Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType byte
ActionType is the type for DDL action.
const ( ActionNone ActionType = iota ActionCreateSchema ActionDropSchema ActionCreateTable ActionDropTable ActionAddColumn ActionDropColumn ActionAddIndex ActionDropIndex ActionAddForeignKey ActionDropForeignKey )
List DDL actions.
func (ActionType) String ¶
func (action ActionType) String() string
type CIStr ¶
type CIStr struct { O string `json:"O"` // Original string. L string `json:"L"` // Lower case string. }
CIStr is case insensitive string.
type ColumnInfo ¶
type ColumnInfo struct { ID int64 `json:"id"` Name CIStr `json:"name"` Offset int `json:"offset"` DefaultValue interface{} `json:"default"` types.FieldType `json:"type"` State SchemaState `json:"state"` Comment string `json:"comment"` }
ColumnInfo provides meta data describing of a table column.
type DBInfo ¶
type DBInfo struct { ID int64 `json:"id"` // Database ID Name CIStr `json:"db_name"` // DB name. Charset string `json:"charset"` Collate string `json:"collate"` Tables []*TableInfo `json:"-"` // Tables in the DB. State SchemaState `json:"state"` }
DBInfo provides meta data describing a DB.
type FKInfo ¶
type FKInfo struct { ID int64 `json:"id"` Name CIStr `json:"fk_name"` RefTable CIStr `json:"ref_table"` RefCols []CIStr `json:"ref_cols"` Cols []CIStr `json:"cols"` OnDelete int `json:"on_delete"` OnUpdate int `json:"on_update"` State SchemaState `json:"state"` }
FKInfo provides meta data describing a foreign key constraint.
type IndexColumn ¶
type IndexColumn struct { Name CIStr `json:"name"` // Index name Offset int `json:"offset"` // Index offset Length int `json:"length"` // Index length }
IndexColumn provides index column info.
type IndexInfo ¶
type IndexInfo struct { ID int64 `json:"id"` Name CIStr `json:"idx_name"` // Index name. Table CIStr `json:"tbl_name"` // Table name. Columns []*IndexColumn `json:"idx_cols"` // Index columns. Unique bool `json:"is_unique"` // Whether the index is unique. Primary bool `json:"is_primary"` // Whether the index is primary key. State SchemaState `json:"state"` Comment string `json:"comment"` // Comment Tp IndexType `json:"index_type"` // Index type: Btree or Hash }
IndexInfo provides meta data describing a DB index. It corresponds to the statement `CREATE INDEX Name ON Table (Column);` See: https://dev.mysql.com/doc/refman/5.7/en/create-index.html
type Job ¶
type Job struct { ID int64 `json:"id"` Type ActionType `json:"type"` SchemaID int64 `json:"schema_id"` TableID int64 `json:"table_id"` State JobState `json:"state"` Error string `json:"err"` // every time we meet an error when running job, we will increase it ErrorCount int64 `json:"err_count"` Args []interface{} `json:"-"` // we must use json raw message for delay parsing special args. RawArgs json.RawMessage `json:"raw_args"` SchemaState SchemaState `json:"schema_state"` // snapshot version for this job. SnapshotVer uint64 `json:"snapshot_ver"` // unix nano seconds // TODO: use timestamp allocated by TSO LastUpdateTS int64 `json:"last_update_ts"` }
Job is for a DDL operation.
func (*Job) Decode ¶
Decode decodes job from the json buffer, we must use DecodeArgs later to decode special args for this job.
func (*Job) DecodeArgs ¶
DecodeArgs decodes job args.
func (*Job) IsFinished ¶
IsFinished returns whether job is finished or not. If the job state is Done or Cancelled, it is finished.
type Owner ¶
type Owner struct { OwnerID string `json:"owner_id"` // unix nano seconds // TODO: use timestamp allocated by TSO LastUpdateTS int64 `json:"last_update_ts"` }
Owner is for DDL Owner.
type SchemaState ¶
type SchemaState byte
SchemaState is the state for schema elements.
const ( // StateNone means this schema element is absent and can't be used. StateNone SchemaState = iota // StateDeleteOnly means we can only delete items for this schema element. StateDeleteOnly // StateWriteOnly means we can use any write operation on this schema element, // but outer can't read the changed data. StateWriteOnly // StateWriteReorganization means we are re-organizating whole data after write only state. StateWriteReorganization // StateDeleteReorganization means we are re-organizating whole data after delete only state. StateDeleteReorganization // StatePublic means this schema element is ok for all write and read operations. StatePublic )
func (SchemaState) String ¶
func (s SchemaState) String() string
String implements fmt.Stringer interface.
type TableInfo ¶
type TableInfo struct { ID int64 `json:"id"` Name CIStr `json:"name"` Charset string `json:"charset"` Collate string `json:"collate"` // Columns are listed in the order in which they appear in the schema. Columns []*ColumnInfo `json:"cols"` Indices []*IndexInfo `json:"index_info"` ForeignKeys []*FKInfo `json:"fk_info"` State SchemaState `json:"state"` PKIsHandle bool `json:"pk_is_handle"` Comment string `json:"comment"` AutoIncID int64 `json:"auto_inc_id"` }
TableInfo provides meta data describing a DB table.