Versions in this module Expand all Collapse all v1 v1.2.1 May 30, 2024 Changes in this version + const SeataATMySQLDriver + const SeataXAMySQLDriver + func CleanTxHooks() + func Init() + func InitAT(cfg undo.Config, asyncCfg AsyncWorkerConfig) + func RegisterTxHook(h txHook) + type ATConn struct + func (c *ATConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) + func (c *ATConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) + func (c *ATConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) + func (c *ATConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) + type ATSourceManager struct + func (a *ATSourceManager) BranchCommit(ctx context.Context, resource rm.BranchResource) (branch.BranchStatus, error) + func (a *ATSourceManager) BranchRegister(ctx context.Context, req rm.BranchRegisterParam) (int64, error) + func (a *ATSourceManager) BranchReport(ctx context.Context, param rm.BranchReportParam) error + func (a *ATSourceManager) BranchRollback(ctx context.Context, branchResource rm.BranchResource) (branch.BranchStatus, error) + func (a *ATSourceManager) CreateTableMetaCache(ctx context.Context, resID string, dbType types.DBType, db *sql.DB) (datasource.TableMetaCache, error) + func (a *ATSourceManager) GetBranchType() branch.BranchType + func (a *ATSourceManager) GetCachedResources() *sync.Map + func (a *ATSourceManager) LockQuery(ctx context.Context, param rm.LockQueryParam) (bool, error) + func (a *ATSourceManager) RegisterResource(res rm.Resource) error + func (a *ATSourceManager) UnregisterResource(res rm.Resource) error + type ATTx struct + func (tx *ATTx) Commit() error + func (tx *ATTx) Rollback() error + type AsyncWorker struct + func NewAsyncWorker(prom prometheus.Registerer, conf AsyncWorkerConfig, ...) *AsyncWorker + func (aw *AsyncWorker) BranchCommit(ctx context.Context, req rm.BranchResource) (branch.BranchStatus, error) + type AsyncWorkerConfig struct + BufferCleanInterval time.Duration + BufferLimit int + CommitWorkerBufferSize int + CommitWorkerCount int + ReceiveChanSize int + func (cfg *AsyncWorkerConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) + type Conn struct + func (c *Conn) Begin() (driver.Tx, error) + func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) + func (c *Conn) Close() error + func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error) + func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) + func (c *Conn) GetAutoCommit() bool + func (c *Conn) Prepare(query string) (driver.Stmt, error) + func (c *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) + func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error) + func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) + func (c *Conn) ResetSession(ctx context.Context) error + type DBResource struct + func (db *DBResource) ConnectionForXA(ctx context.Context, xaXid XAXid) (*XAConn, error) + func (db *DBResource) GetBranchType() branch.BranchType + func (db *DBResource) GetDB() *sql.DB + func (db *DBResource) GetDBName() string + func (db *DBResource) GetDbType() types.DBType + func (db *DBResource) GetDbVersion() string + func (db *DBResource) GetKeeper() *sync.Map + func (db *DBResource) GetResourceGroupId() string + func (db *DBResource) GetResourceId() string + func (db *DBResource) Hold(xaBranchID string, v interface{}) error + func (db *DBResource) IsShouldBeHeld() bool + func (db *DBResource) Lookup(xaBranchID string) (interface{}, bool) + func (db *DBResource) Release(xaBranchID string) + func (db *DBResource) SetDbType(dbType types.DBType) + func (db *DBResource) SetDbVersion(v string) + type Option func(*XABranchXid) + func WithBranchId(branchId uint64) Option + func WithBranchQualifier(branchQualifier []byte) Option + func WithGlobalTransactionId(globalTransactionId []byte) Option + func WithXid(xid string) Option + type Stmt struct + func (s *Stmt) Close() error + func (s *Stmt) Exec(args []driver.Value) (driver.Result, error) + func (s *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) + func (s *Stmt) NumInput() int + func (s *Stmt) Query(args []driver.Value) (driver.Rows, error) + func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) + type Tx struct + func (tx *Tx) Commit() error + func (tx *Tx) Rollback() error + type XABranchXid struct + func NewXABranchXid(opt ...Option) *XABranchXid + func XaIdBuild(xid string, branchId uint64) *XABranchXid + func XaIdBuildWithByte(globalTransactionId []byte, branchQualifier []byte) *XABranchXid + func (x *XABranchXid) GetBranchId() uint64 + func (x *XABranchXid) GetBranchQualifier() []byte + func (x *XABranchXid) GetGlobalTransactionId() []byte + func (x *XABranchXid) GetGlobalXid() string + func (x *XABranchXid) String() string + type XAConfig struct + TwoPhaseHoldTime time.Duration + func (cfg *XAConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) + type XAConn struct + func (c *XAConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) + func (c *XAConn) Close() error + func (c *XAConn) CloseForce() error + func (c *XAConn) Commit(ctx context.Context) error + func (c *XAConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) + func (c *XAConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) + func (c *XAConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) + func (c *XAConn) Rollback(ctx context.Context) error + func (c *XAConn) ShouldBeHeld() bool + func (c *XAConn) XaCommit(ctx context.Context, xaXid XAXid) error + func (c *XAConn) XaRollback(ctx context.Context, xaXid XAXid) error + func (c *XAConn) XaRollbackByBranchId(ctx context.Context, xaXid XAXid) error + type XAConnConf struct + XaBranchExecutionTimeout time.Duration + func (cfg *XAConnConf) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) + type XAResourceManager struct + func InitXA(config XAConfig) *XAResourceManager + func (xaManager *XAResourceManager) BranchCommit(ctx context.Context, branchResource rm.BranchResource) (branch.BranchStatus, error) + func (xaManager *XAResourceManager) BranchRegister(ctx context.Context, req rm.BranchRegisterParam) (int64, error) + func (xaManager *XAResourceManager) BranchReport(ctx context.Context, param rm.BranchReportParam) error + func (xaManager *XAResourceManager) BranchRollback(ctx context.Context, branchResource rm.BranchResource) (branch.BranchStatus, error) + func (xaManager *XAResourceManager) CreateTableMetaCache(ctx context.Context, resID string, dbType types.DBType, db *sql.DB) (datasource.TableMetaCache, error) + func (xaManager *XAResourceManager) GetBranchType() branch.BranchType + func (xaManager *XAResourceManager) GetCachedResources() *sync.Map + func (xaManager *XAResourceManager) LockQuery(ctx context.Context, param rm.LockQueryParam) (bool, error) + func (xaManager *XAResourceManager) RegisterResource(res rm.Resource) error + func (xaManager *XAResourceManager) UnregisterResource(resource rm.Resource) error + type XATx struct + func (tx *XATx) Commit() error + func (tx *XATx) Rollback() error + type XAXid interface + GetBranchId func() uint64 + GetGlobalXid func() string + String func() string