# README
English | 简体中文
dtmcli
dtmcli
is the http client sdk for dtm, a distributed transaction framework.
The code of this library is fully synchronised with the dtmcli directory under dtm. There will be very few dependencies associated with the current dtmcli and smaller size for the final binary file.
For detailed documentation and usage, please refer to dtm
a complete sample
# Functions
BarrierFrom construct transaction info from request.
BarrierFromQuery construct transaction info from request.
GetCurrentDBType get currentDBType.
GetRestyClient get the resty.Client for http request.
GetXaSQLTimeoutMs get XaSQLTimeoutMs.
MustGenGid generate a new gid.
NewMsg create new msg.
NewSaga create a saga.
Result2HttpJSON return the http code and json result if result is error, the return proper code, else return StatusOK.
SetBarrierTableName sets barrier table name.
SetCurrentDBType set currentDBType.
SetPassthroughHeaders experimental.
SetXaSQLTimeoutMs set XaSQLTimeoutMs.
String2DtmError translate string to dtm error.
TccFromQuery tcc from request info.
TccGlobalTransaction begin a tcc global transaction dtm dtm server address gid global transaction ID tccFunc define the detail tcc busi.
TccGlobalTransaction2 new version of TccGlobalTransaction, add custom param.
XaFromQuery construct xa info from request.
XaGlobalTransaction start a xa global transaction.
XaGlobalTransaction2 start a xa global transaction with xa custom function.
XaLocalTransaction start a xa local transaction.
# Constants
DBTypeMysql const for driver mysql.
DBTypePostgres const for driver postgres.
ResultFailure for result of a trans/trans branch.
ResultOngoing for result of a trans/trans branch.
ResultSuccess for result of a trans/trans branch.
StatusAborting status for global trans status.
StatusFailed status for global/branch trans status.
StatusPrepared status for global/branch trans status.
StatusSubmitted status for global trans status.
StatusSucceed status for global/branch trans status.
# Variables
ErrDuplicated error of DUPLICATED for only msg if QueryPrepared executed before call.
ErrFailure error for returned failure.
ErrOngoing error for returned ongoing.
MapFailure HTTP result of FAILURE.
MapSuccess HTTP result of SUCCESS.
# Structs
BranchBarrier every branch info.
Msg reliable msg type.
Saga struct of saga.
Tcc struct of tcc.
Xa xa transaction.
# Type aliases
BarrierBusiFunc type for busi func.
DB interface.
DBConf declares db configuration.
TccGlobalFunc type of global tcc call.
TransOptions transaction option.
XaGlobalFunc type of xa global function.
XaLocalFunc type of xa local function.