Documentation ¶
Index ¶
- Constants
- func LoadPtTemplateFromFile(fileName string) error
- type Config
- type Inspect
- func (i *Inspect) Audit(ctx context.Context, sql string) (*driver.AuditResult, error)
- func (i *Inspect) CheckExplain(node ast.Node) error
- func (i *Inspect) CheckInvalid(node ast.Node) error
- func (i *Inspect) CheckInvalidOffline(node ast.Node) error
- func (i *Inspect) Close(ctx context.Context)
- func (i *Inspect) Context() *session.Context
- func (i *Inspect) Exec(ctx context.Context, query string) (_driver.Result, error)
- func (i *Inspect) GenRollbackSQL(ctx context.Context, sql string) (string, string, error)
- func (i *Inspect) GenerateDDLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
- func (i *Inspect) GenerateDMLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
- func (i *Inspect) GenerateRollbackSql(node ast.Node) (string, string, error)
- func (i *Inspect) IsOfflineAudit() bool
- func (i *Inspect) Logger() *logrus.Entry
- func (i *Inspect) Parse(ctx context.Context, sqlText string) ([]driver.Node, error)
- func (i *Inspect) ParseSql(sql string) ([]ast.Node, error)
- func (i *Inspect) Ping(ctx context.Context) error
- func (i *Inspect) Query(ctx context.Context, query string, args ...interface{}) ([]map[string]sql.NullString, error)
- func (i *Inspect) Schemas(ctx context.Context) ([]string, error)
- func (i *Inspect) Tx(ctx context.Context, queries ...string) ([]_driver.Result, error)
Constants ¶
View Source
const ( SchemaNotExistMessage = "schema %s 不存在" SchemaExistMessage = "schema %s 已存在" TableNotExistMessage = "表 %s 不存在" TableExistMessage = "表 %s 已存在" ColumnNotExistMessage = "字段 %s 不存在" ColumnExistMessage = "字段 %s 已存在" ColumnIsAmbiguousMessage = "字段 %s 指代不明" IndexNotExistMessage = "索引 %s 不存在" IndexExistMessage = "索引 %s 已存在" DuplicateColumnsMessage = "字段名 %s 重复" DuplicateIndexesMessage = "索引名 %s 重复" MultiPrimaryKeyMessage = "主键只能设置一个" KeyedColumnNotExistMessage = "索引字段 %s 不存在" PrimaryKeyExistMessage = "已经存在主键,不能再添加" PrimaryKeyNotExistMessage = "当前没有主键,不能执行删除" ColumnsValuesNotMatchMessage = "指定的值列数与字段列数不匹配" DuplicatePrimaryKeyedColumnMessage = "主键字段 %s 重复" DuplicateIndexedColumnMessage = "索引 %s 字段 %s重复" )
View Source
const ( PTOSCNoUniqueIndexOrPrimaryKey = "至少要包含主键或者唯一键索引才能使用 pt-online-schema-change" PTOSCAvoidUniqueIndex = "" /* 127-byte string literal not displayed */ PTOSCAvoidRenameTable = "pt-online-schema-change 不支持使用rename table 来重命名表" PTOSCAvoidNoDefaultValueOnNotNullColumn = "非空字段必须设置默认值,不然 pt-online-schema-change 会执行失败" )
View Source
const ( NotSupportStatementRollback = "暂不支持回滚该类型的语句" NotSupportMultiTableStatementRollback = "暂不支持回滚多表的 DML 语句" NotSupportOnDuplicatStatementRollback = "暂不支持回滚 ON DUPLICATE 语句" NotSupportSubQueryStatementRollback = "暂不支持回滚带子查询的语句" NotSupportNoPrimaryKeyTableRollback = "不支持回滚没有主键的表的DML语句" NotSupportInsertWithoutPrimaryKeyRollback = "不支持回滚 INSERT 没有指定主键的语句" NotSupportExceedMaxRowsRollback = "预计影响行数超过配置的最大值,不生成回滚语句" )
View Source
const CheckInvalidErrorFormat = "预检查失败: %v"
Variables ¶
This section is empty.
Functions ¶
func LoadPtTemplateFromFile ¶
Types ¶
type Inspect ¶
type Inspect struct { // Ctx is SQL session. Ctx *session.Context // HasInvalidSql represent one of the commit sql base-validation failed. HasInvalidSql bool // contains filtered or unexported fields }
Inspect implements driver.Driver interface
func (*Inspect) CheckExplain ¶ added in v1.2201.0
func (*Inspect) GenRollbackSQL ¶
func (*Inspect) GenerateDDLStmtRollbackSql ¶
func (*Inspect) GenerateDMLStmtRollbackSql ¶
func (*Inspect) GenerateRollbackSql ¶
func (*Inspect) IsOfflineAudit ¶
Click to show internal directories.
Click to hide internal directories.