Documentation ¶
Index ¶
- Constants
- func LoadPtTemplateFromFile(fileName string) error
- func NewDriverManagerFunc(log *logrus.Entry, dbType string, config *driver.Config, ...) (driver.DriverManager, error)
- type Config
- type DriverManager
- type MysqlDriverImpl
- func (i *MysqlDriverImpl) Audit(ctx context.Context, sql string) (*driver.AuditResult, error)
- func (i *MysqlDriverImpl) CheckExplain(node ast.Node) error
- func (i *MysqlDriverImpl) CheckInvalid(node ast.Node) error
- func (i *MysqlDriverImpl) CheckInvalidOffline(node ast.Node) error
- func (i *MysqlDriverImpl) Close(ctx context.Context)
- func (i *MysqlDriverImpl) Context() *session.Context
- func (i *MysqlDriverImpl) Exec(ctx context.Context, query string) (_driver.Result, error)
- func (i *MysqlDriverImpl) GenRollbackSQL(ctx context.Context, sql string) (string, string, error)
- func (i *MysqlDriverImpl) GenerateDDLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
- func (i *MysqlDriverImpl) GenerateDMLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
- func (i *MysqlDriverImpl) GenerateRollbackSql(node ast.Node) (string, string, error)
- func (i *MysqlDriverImpl) IsOfflineAudit() bool
- func (i *MysqlDriverImpl) Logger() *logrus.Entry
- func (i *MysqlDriverImpl) Parse(ctx context.Context, sqlText string) ([]driver.Node, error)
- func (i *MysqlDriverImpl) ParseSql(sql string) ([]ast.Node, error)
- func (i *MysqlDriverImpl) Ping(ctx context.Context) error
- func (i *MysqlDriverImpl) Schemas(ctx context.Context) ([]string, error)
- func (i *MysqlDriverImpl) 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 ¶
func NewDriverManagerFunc ¶ added in v1.2207.0
func NewDriverManagerFunc(log *logrus.Entry, dbType string, config *driver.Config, client *driver.PluginClient) (driver.DriverManager, error)
Types ¶
type DriverManager ¶ added in v1.2207.0
type DriverManager struct {
// contains filtered or unexported fields
}
func (*DriverManager) Close ¶ added in v1.2207.0
func (d *DriverManager) Close(ctx context.Context)
func (*DriverManager) GetAnalysisDriver ¶ added in v1.2207.0
func (d *DriverManager) GetAnalysisDriver() (driver.AnalysisDriver, error)
func (*DriverManager) GetAuditDriver ¶ added in v1.2207.0
func (d *DriverManager) GetAuditDriver() (driver.Driver, error)
func (*DriverManager) GetSQLQueryDriver ¶ added in v1.2207.0
func (d *DriverManager) GetSQLQueryDriver() (driver.SQLQueryDriver, error)
type MysqlDriverImpl ¶ added in v1.2207.0
type MysqlDriverImpl 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 }
MysqlDriverImpl implements driver.Driver interface
func NewInspect ¶ added in v1.2206.0
func (*MysqlDriverImpl) Audit ¶ added in v1.2207.0
func (i *MysqlDriverImpl) Audit(ctx context.Context, sql string) (*driver.AuditResult, error)
func (*MysqlDriverImpl) CheckExplain ¶ added in v1.2207.0
func (i *MysqlDriverImpl) CheckExplain(node ast.Node) error
func (*MysqlDriverImpl) CheckInvalid ¶ added in v1.2207.0
func (i *MysqlDriverImpl) CheckInvalid(node ast.Node) error
func (*MysqlDriverImpl) CheckInvalidOffline ¶ added in v1.2207.0
func (i *MysqlDriverImpl) CheckInvalidOffline(node ast.Node) error
func (*MysqlDriverImpl) Close ¶ added in v1.2207.0
func (i *MysqlDriverImpl) Close(ctx context.Context)
func (*MysqlDriverImpl) Context ¶ added in v1.2207.0
func (i *MysqlDriverImpl) Context() *session.Context
func (*MysqlDriverImpl) GenRollbackSQL ¶ added in v1.2207.0
func (*MysqlDriverImpl) GenerateDDLStmtRollbackSql ¶ added in v1.2207.0
func (i *MysqlDriverImpl) GenerateDDLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
func (*MysqlDriverImpl) GenerateDMLStmtRollbackSql ¶ added in v1.2207.0
func (i *MysqlDriverImpl) GenerateDMLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)
func (*MysqlDriverImpl) GenerateRollbackSql ¶ added in v1.2207.0
func (*MysqlDriverImpl) IsOfflineAudit ¶ added in v1.2207.0
func (i *MysqlDriverImpl) IsOfflineAudit() bool
func (*MysqlDriverImpl) Logger ¶ added in v1.2207.0
func (i *MysqlDriverImpl) Logger() *logrus.Entry
func (*MysqlDriverImpl) ParseSql ¶ added in v1.2207.0
func (i *MysqlDriverImpl) ParseSql(sql string) ([]ast.Node, error)
func (*MysqlDriverImpl) Ping ¶ added in v1.2207.0
func (i *MysqlDriverImpl) Ping(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.