Versions in this module Expand all Collapse all v1 v1.14.4 Jul 11, 2022 Changes in this version + const DBTypeMysql + const DBTypePostgres + const ResultFailure + const ResultOngoing + const ResultSuccess + const StatusAborting + const StatusFailed + const StatusPrepared + const StatusSubmitted + const StatusSucceed + var ErrDuplicated = dtmimp.ErrDuplicated + var ErrFailure = dtmimp.ErrFailure + var ErrOngoing = dtmimp.ErrOngoing + var MapFailure = dtmimp.MapFailure + var MapSuccess = dtmimp.MapSuccess + func GetCurrentDBType() string + func GetRestyClient() *resty.Client + func GetXaSQLTimeoutMs() int + func MustGenGid(server string) string + func Result2HttpJSON(result interface{}) (code int, res interface{}) + func SetBarrierTableName(tablename string) + func SetCurrentDBType(dbType string) + func SetPassthroughHeaders(headers []string) + func SetXaSQLTimeoutMs(ms int) + func String2DtmError(str string) error + func TccGlobalTransaction(dtm string, gid string, tccFunc TccGlobalFunc) (rerr error) + func TccGlobalTransaction2(dtm string, gid string, custom func(*Tcc), tccFunc TccGlobalFunc) (rerr error) + func XaGlobalTransaction(server string, gid string, xaFunc XaGlobalFunc) error + func XaGlobalTransaction2(server string, gid string, custom func(*Xa), xaFunc XaGlobalFunc) (rerr error) + func XaLocalTransaction(qs url.Values, dbConf DBConf, xaFunc XaLocalFunc) error + type BarrierBusiFunc func(tx *sql.Tx) error + type BranchBarrier struct + BarrierID int + BarrierTableName string + BranchID string + DBType string + Gid string + Op string + TransType string + func BarrierFrom(transType, gid, branchID, op string) (*BranchBarrier, error) + func BarrierFromQuery(qs url.Values) (*BranchBarrier, error) + func (bb *BranchBarrier) Call(tx *sql.Tx, busiCall BarrierBusiFunc) (rerr error) + func (bb *BranchBarrier) CallWithDB(db *sql.DB, busiCall BarrierBusiFunc) error + func (bb *BranchBarrier) MongoCall(mc *mongo.Client, busiCall func(mongo.SessionContext) error) (rerr error) + func (bb *BranchBarrier) MongoQueryPrepared(mc *mongo.Client) error + func (bb *BranchBarrier) QueryPrepared(db *sql.DB) error + func (bb *BranchBarrier) RedisCheckAdjustAmount(rd *redis.Client, key string, amount int, barrierExpire int) error + func (bb *BranchBarrier) RedisQueryPrepared(rd *redis.Client, barrierExpire int) error + func (bb *BranchBarrier) String() string + type DB = dtmimp.DB + type DBConf = dtmimp.DBConf + type Msg struct + func NewMsg(server string, gid string) *Msg + func (s *Msg) Add(action string, postData interface{}) *Msg + func (s *Msg) BuildCustomOptions() + func (s *Msg) DoAndSubmit(queryPrepared string, busiCall func(bb *BranchBarrier) error) error + func (s *Msg) DoAndSubmitDB(queryPrepared string, db *sql.DB, busiCall BarrierBusiFunc) error + func (s *Msg) Prepare(queryPrepared string) error + func (s *Msg) SetDelay(delay uint64) *Msg + func (s *Msg) Submit() error + type Saga struct + func NewSaga(server string, gid string) *Saga + func (s *Saga) Add(action string, compensate string, postData interface{}) *Saga + func (s *Saga) AddBranchOrder(branch int, preBranches []int) *Saga + func (s *Saga) BuildCustomOptions() + func (s *Saga) SetConcurrent() *Saga + func (s *Saga) Submit() error + type Tcc struct + func TccFromQuery(qs url.Values) (*Tcc, error) + func (t *Tcc) CallBranch(body interface{}, tryURL string, confirmURL string, cancelURL string) (*resty.Response, error) + type TccGlobalFunc func(tcc *Tcc) (*resty.Response, error) + type TransOptions = dtmimp.TransOptions + type Xa struct + Phase2URL string + func XaFromQuery(qs url.Values) (*Xa, error) + func (x *Xa) CallBranch(body interface{}, url string) (*resty.Response, error) + type XaGlobalFunc func(xa *Xa) (*resty.Response, error) + type XaLocalFunc func(db *sql.DB, xa *Xa) error