Versions in this module Expand all Collapse all v2 v2.0.4 Sep 17, 2021 Changes in this version + const ARRAY + const BIGINT + const BINARY + const BIT + const BLOB + const BOOLEAN + const CHAR + const CLOB + const DATALINK + const DATE + const DECIMAL + const DISTINCT + const DOUBLE + const DeleteSqlTemplate + const DeleteUndoLogByCreateSql + const DeleteUndoLogSql + const FLOAT + const GlobalLock + const INTEGER + const InsertSqlTemplate + const InsertUndoLogSql + const JAVA_OBJECT + const LONGNVARCHAR + const LONGVARBINARY + const LONGVARCHAR + const NCHAR + const NCLOB + const NULL + const NUMERIC + const NVARCHAR + const OTHER + const REAL + const REF + const REF_CURSOR + const ROWID + const SMALLINT + const SQLXML + const STRUCT + const SelectSqlTemplate + const SelectUndoLogSql + const TIME + const TIMESTAMP + const TIMESTAMP_WITH_TIMEZONE + const TIME_WITH_TIMEZONE + const TINYINT + const UpdateSqlTemplate + const VARBINARY + const VARCHAR + const XID + var EXPIRE_TIME = 15 * time.Minute + var ErrBusyBuffer = errors.New("busy buffer") + var ErrCleartextPassword = errors.New(...) + var ErrInvalidConn = errors.New("invalid connection") + var ErrMalformPkt = errors.New("malformed packet") + var ErrNativePassword = errors.New("this user requires mysql native password authentication.") + var ErrNoTLS = errors.New("TLS requested but server does not support TLS") + var ErrOldPassword = errors.New(...) + var ErrOldProtocol = errors.New("MySQL server does not support required protocol 41+") + var ErrPktSync = errors.New("commands out of sync. You can't run this command now") + var ErrPktSyncMul = errors.New("commands out of sync. Did you run multiple statements at once?") + var ErrPktTooLarge = errors.New(...) + var ErrUnknownPlugin = errors.New("this authentication plugin is not supported") + var MySQLKeyword = map[string]string + var SqlDataTypes = map[string]int32 + func Check(fieldOrTableName string) bool + func CheckAndReplace(fieldOrTableName string) string + func CheckEscape(fieldOrTableName string) bool + func DeleteBuildUndoSql(undoLog sqlUndoLog) string + func DeregisterLocalFile(filePath string) + func DeregisterReaderHandler(name string) + func DeregisterServerPubKey(name string) + func DeregisterTLSConfig(key string) + func GetColumns(conn *mysqlConn, dbName, tableName string) ([]schema.ColumnMeta, error) + func GetIndexes(conn *mysqlConn, dbName, tableName string) ([]schema.IndexMeta, error) + func GetSqlDataType(dataType string) int32 + func InitTableMetaCache(dbName string) + func InsertBuildUndoSql(undoLog sqlUndoLog) string + func NewConnector(cfg *Config) (driver.Connector, error) + func RegisterDial(network string, dial DialFunc) + func RegisterDialContext(net string, dial DialContextFunc) + func RegisterLocalFile(filePath string) + func RegisterReaderHandler(name string, handler func() io.Reader) + func RegisterResource(dsn string) + func RegisterServerPubKey(name string, pubKey *rsa.PublicKey) + func RegisterTLSConfig(key string, config *tls.Config) error + func SetLogger(logger Logger) error + func UpdateBuildUndoSql(undoLog sqlUndoLog) string + type BuildUndoSql func(undoLog sqlUndoLog) string + type Config struct + Addr string + AllowAllFiles bool + AllowCleartextPasswords bool + AllowNativePasswords bool + AllowOldPasswords bool + CheckConnLiveness bool + ClientFoundRows bool + Collation string + ColumnsWithAlias bool + DBName string + InterpolateParams bool + Loc *time.Location + MaxAllowedPacket int + MultiStatements bool + Net string + Params map[string]string + ParseTime bool + Passwd string + ReadTimeout time.Duration + RejectReadOnly bool + ServerPubKey string + TLSConfig string + Timeout time.Duration + User string + WriteTimeout time.Duration + func NewConfig() *Config + func ParseDSN(dsn string) (cfg *Config, err error) + func (cfg *Config) Clone() *Config + func (cfg *Config) FormatDSN() string + type DataSourceManager struct + ResourceCache map[string]*connector + func GetDataSourceManager() DataSourceManager + func (resourceManager DataSourceManager) BranchCommit(ctx context.Context, request *apis.BranchCommitRequest) (*apis.BranchCommitResponse, error) + func (resourceManager DataSourceManager) BranchRollback(ctx context.Context, request *apis.BranchRollbackRequest) (*apis.BranchRollbackResponse, error) + func (resourceManager DataSourceManager) GetBranchType() apis.BranchSession_BranchType + func (resourceManager DataSourceManager) GetConnection(resourceID string) *mysqlConn + func (resourceManager DataSourceManager) RegisterResource(resource model.Resource) + func (resourceManager DataSourceManager) UnregisterResource(resource model.Resource) + type DialContextFunc func(ctx context.Context, addr string) (net.Conn, error) + type DialFunc func(addr string) (net.Conn, error) + type Logger interface + Print func(v ...interface{}) + type MySQLDriver struct + func (d MySQLDriver) Open(dsn string) (driver.Conn, error) + func (d MySQLDriver) OpenConnector(dsn string) (driver.Connector, error) + type MySQLError struct + Message string + Number uint16 + func (me *MySQLError) Error() string + type MysqlUndoExecutor struct + func NewMysqlUndoExecutor(undoLog sqlUndoLog) MysqlUndoExecutor + func (executor MysqlUndoExecutor) Execute(conn *mysqlConn) error + type MysqlUndoLogManager struct + func GetUndoLogManager() MysqlUndoLogManager + func (manager MysqlUndoLogManager) BatchDeleteUndoLog(conn *mysqlConn, xids []string, branchIDs []int64) error + func (manager MysqlUndoLogManager) DeleteUndoLog(conn *mysqlConn, xid string, branchID int64) error + func (manager MysqlUndoLogManager) DeleteUndoLogByLogCreated(conn *mysqlConn, logCreated time.Time, limitRows int) (sql.Result, error) + func (manager MysqlUndoLogManager) FlushUndoLogs(conn *mysqlConn) error + func (manager MysqlUndoLogManager) Undo(conn *mysqlConn, xid string, branchID int64, resourceID string) error + type NullTime sql.NullTime + func (nt *NullTime) Scan(value interface{}) (err error) + func (nt NullTime) Value() (driver.Value, error) + type PbBranchUndoLog struct + BranchID int64 + SqlUndoLogs []*PbSqlUndoLog + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + Xid string + func (*PbBranchUndoLog) Descriptor() ([]byte, []int) + func (*PbBranchUndoLog) ProtoMessage() + func (m *PbBranchUndoLog) GetBranchID() int64 + func (m *PbBranchUndoLog) GetSqlUndoLogs() []*PbSqlUndoLog + func (m *PbBranchUndoLog) GetXid() string + func (m *PbBranchUndoLog) Reset() + func (m *PbBranchUndoLog) String() string + func (m *PbBranchUndoLog) XXX_DiscardUnknown() + func (m *PbBranchUndoLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PbBranchUndoLog) XXX_Merge(src proto.Message) + func (m *PbBranchUndoLog) XXX_Size() int + func (m *PbBranchUndoLog) XXX_Unmarshal(b []byte) error + type PbField struct + KeyType int32 + Name string + Type int32 + Value []byte + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PbField) Descriptor() ([]byte, []int) + func (*PbField) ProtoMessage() + func (m *PbField) GetKeyType() int32 + func (m *PbField) GetName() string + func (m *PbField) GetType() int32 + func (m *PbField) GetValue() []byte + func (m *PbField) Reset() + func (m *PbField) String() string + func (m *PbField) XXX_DiscardUnknown() + func (m *PbField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PbField) XXX_Merge(src proto.Message) + func (m *PbField) XXX_Size() int + func (m *PbField) XXX_Unmarshal(b []byte) error + type PbRow struct + Fields []*PbField + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PbRow) Descriptor() ([]byte, []int) + func (*PbRow) ProtoMessage() + func (m *PbRow) GetFields() []*PbField + func (m *PbRow) Reset() + func (m *PbRow) String() string + func (m *PbRow) XXX_DiscardUnknown() + func (m *PbRow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PbRow) XXX_Merge(src proto.Message) + func (m *PbRow) XXX_Size() int + func (m *PbRow) XXX_Unmarshal(b []byte) error + type PbSqlUndoLog struct + AfterImage *PbTableRecords + BeforeImage *PbTableRecords + SqlType int32 + TableName string + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PbSqlUndoLog) Descriptor() ([]byte, []int) + func (*PbSqlUndoLog) ProtoMessage() + func (m *PbSqlUndoLog) GetAfterImage() *PbTableRecords + func (m *PbSqlUndoLog) GetBeforeImage() *PbTableRecords + func (m *PbSqlUndoLog) GetSqlType() int32 + func (m *PbSqlUndoLog) GetTableName() string + func (m *PbSqlUndoLog) Reset() + func (m *PbSqlUndoLog) String() string + func (m *PbSqlUndoLog) XXX_DiscardUnknown() + func (m *PbSqlUndoLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PbSqlUndoLog) XXX_Merge(src proto.Message) + func (m *PbSqlUndoLog) XXX_Size() int + func (m *PbSqlUndoLog) XXX_Unmarshal(b []byte) error + type PbTableRecords struct + Rows []*PbRow + TableName string + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PbTableRecords) Descriptor() ([]byte, []int) + func (*PbTableRecords) ProtoMessage() + func (m *PbTableRecords) GetRows() []*PbRow + func (m *PbTableRecords) GetTableName() string + func (m *PbTableRecords) Reset() + func (m *PbTableRecords) String() string + func (m *PbTableRecords) XXX_DiscardUnknown() + func (m *PbTableRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PbTableRecords) XXX_Merge(src proto.Message) + func (m *PbTableRecords) XXX_Size() int + func (m *PbTableRecords) XXX_Unmarshal(b []byte) error + type ProtoBufUndoLogParser struct + func (parser ProtoBufUndoLogParser) Decode(data []byte) *branchUndoLog + func (parser ProtoBufUndoLogParser) Encode(branchUndoLog *branchUndoLog) []byte + func (parser ProtoBufUndoLogParser) GetDefaultContent() []byte + func (parser ProtoBufUndoLogParser) GetName() string + type RawBytes []byte + type SQLType byte + const SQLType_ALTER + const SQLType_ALTER_TABLE + const SQLType_CREATE + const SQLType_CREATE_INDEX + const SQLType_CREATE_TABLE + const SQLType_DEBUG + const SQLType_DELETE + const SQLType_DESC + const SQLType_DROP + const SQLType_DROP_INDEX + const SQLType_DROP_TABLE + const SQLType_DUMP + const SQLType_EXPLAIN + const SQLType_INSERT + const SQLType_LOAD + const SQLType_MERGE + const SQLType_MULTI_DELETE + const SQLType_MULTI_UPDATE + const SQLType_PROCEDURE + const SQLType_RELOAD + const SQLType_RENAME + const SQLType_REPLACE + const SQLType_SAVE_POINT + const SQLType_SELECT + const SQLType_SELECT_FOR_UPDATE + const SQLType_SELECT_FROM_UPDATE + const SQLType_SELECT_UNION + const SQLType_SET + const SQLType_SHOW + const SQLType_TRUNCATE + const SQLType_UPDATE + func (sqlType SQLType) String() string + type Scanner interface + Scan func(src interface{}) error + type SqlDataType int32 + type State byte + const GlobalFinished + const Normal + func (state State) String() string + type TableMetaCache struct + func GetTableMetaCache(dbName string) *TableMetaCache + func (cache *TableMetaCache) FetchSchema(conn *mysqlConn, tableName string) (schema.TableMeta, error) + func (cache *TableMetaCache) GetCacheKey(tableName string) string + func (cache *TableMetaCache) GetTableMeta(conn *mysqlConn, tableName string) (schema.TableMeta, error) + func (cache *TableMetaCache) Refresh(conn *mysqlConn, resourceID string) + type UndoLogParser interface + Decode func(data []byte) *branchUndoLog + Encode func(branchUndoLog *branchUndoLog) []byte + GetDefaultContent func() []byte + GetName func() string + func GetUndoLogParser() UndoLogParser