package
1.17.3
Repository: https://github.com/dtm-labs/client.git
Documentation: pkg.go.dev

# README

Notice

Please donot use this package, and this package should only be used in dtm internally. The interfaces are not stable, and package name has postfix "imp"

# Functions

AddRestyMiddlewares will add the middlewares used by dtm.
AsError wrap a panic value as an error.
CatchP catch panic to error.
DBExec use raw db to exec.
DeferDo a common defer do used in dtmcli/dtmgrpc.
E2P error to panic.
Escape solve CodeQL reported problem.
EscapeGet escape get.
GetCurrentDBType get currentDBType.
GetDBSpecial get DBSpecial for currentDBType.
GetDsn get dsn from map config.
GetFuncName get current call func name.
GetRestyClient2 will return a resty client with timeout set.
If ternary operator.
InsertBarrier insert a record to barrier.
MayReplaceLocalhost when run in docker compose, change localhost to host.docker.internal for accessing host network.
MustAtoi is string to int.
MustMarshal checked version for marshal.
MustMarshalString string version of MustMarshal.
MustRemarshal marshal and unmarshal, and check error.
MustUnmarshal checked version for unmarshal.
MustUnmarshalString string version of MustUnmarshal.
NewTransBase new a TransBase.
OrString return the first not empty string.
P2E panic to error.
PanicIf name is clear.
PooledDB get pooled sql.DB.
RespAsErrorByJSONRPC translate json rpc resty response to error.
SetCurrentDBType set currentDBType.
StandaloneDB get a standalone db instance.
TransBaseFromQuery construct transaction info from request.
TransCallDtm is the short call for TransCallDtmExt.
TransCallDtmExt TransBase call dtm.
TransRegisterBranch TransBase register a branch to dtm.
TransRequestBranch TransBase request branch result.
XaClose will log and close the db.
XaDB return a standalone db instance for xa.
XaHandleGlobalTrans http/grpc GlobalTransaction shared func.
XaHandleLocalTrans public handler of LocalTransaction via http/grpc.
XaHandlePhase2 Handle the callback of commit/rollback.

# Constants

DBTypeMysql const for driver mysql.
DBTypePostgres const for driver postgres.
DBTypeRedis const for driver redis.
Jrpc const for json-rpc.
JrpcCodeFailure const for json-rpc failure.
JrpcCodeOngoing const for json-rpc ongoing.
MsgDoBarrier1 const for DoAndSubmit barrier barrierID.
MsgDoBranch0 const for DoAndSubmit barrier branch.
MsgDoOp const for DoAndSubmit barrier op.
MsgTopicPrefix const for Add topic msg.
OpAction branch type for message, SAGA, XA.
OpCancel branch type for TCC.
OpCommit branch type for XA.
OpCompensate branch type for SAGA.
OpConfirm branch type for TCC.
OpRollback branch type for XA.
OpTry branch type for TCC.
ProtocolGRPC const for protocol grpc.
ProtocolHTTP const for protocol http.
ResultFailure for result of a trans/trans branch Same as HTTP status 409 and GRPC code 10.
ResultOngoing for result of a trans/trans branch Same as HTTP status 425 and GRPC code 9.
ResultSuccess for result of a trans/trans branch Same as HTTP status 200 and GRPC code 0.
XaBarrier1 const for xa barrier id.

# Variables

BarrierTableName the table name of barrier table.
ErrDuplicated error of DUPLICATED for only msg if QueryPrepared executed before call.
ErrFailure error of FAILURE.
ErrOngoing error of ONGOING.
FatalIfError fatal if error is not nil Deprecated: use logger.FatalIfError.
Logf an alias of Infof Deprecated: use logger.Errorf.
LogIfFatalf fatal if cond is true Deprecated: use logger.FatalfIf.
LogRedf an alias of Errorf Deprecated: use logger.Errorf.
MapFailure HTTP result of FAILURE.
MapSuccess HTTP result of SUCCESS.

# Structs

BranchIDGen used to generate a sub branch id.
DBConf defines db config.
TransBase base for all trans.
TransOptions transaction options.

# Interfaces

DB inteface of dtmcli db.
DBSpecial db specific operations.