Documentation
¶
Index ¶
- func Commit(ctx context.Context) error
- func GORMTx(ctx context.Context, db *gorm.DB) *gorm.DB
- func Middleware(opts ...ManagerOption) middleware.Middleware
- func Rollback(ctx context.Context) error
- func SqlxTx(ctx context.Context, db *sqlx.DB) (*sqlx.Tx, error)
- type GORMTransaction
- type GORMTransactionKey
- type InitHandler
- type ManagerOption
- type Orchestrator
- type OrchestratorContextKey
- type SqlxTransaction
- type SqlxTransactionKey
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(opts ...ManagerOption) middleware.Middleware
Middleware 用于处理事务提交和回滚的中间件。 opts: ManagerOption 采用先进先出的形式
Types ¶
type GORMTransaction ¶
type GORMTransaction struct {
// contains filtered or unexported fields
}
type ManagerOption ¶
type ManagerOption func(*manager)
ManagerOption 事务管理器选项设置
func GORM ¶
func GORM(db *gorm.DB) ManagerOption
func Sqlx ¶
func Sqlx(db *sqlx.DB) ManagerOption
type Orchestrator ¶
type Orchestrator struct { // Tx 有序的 map[struct{}]Transaction Tx *orderedmap.OrderedMap[struct{}, Transaction] }
Orchestrator 协调器
func GetOrchestratorFromContext ¶
func GetOrchestratorFromContext(ctx context.Context) *Orchestrator
GetOrchestratorFromContext 从上下文中获取事务协调器
type OrchestratorContextKey ¶
type OrchestratorContextKey struct{}
OrchestratorContextKey 上下文的事务协调器唯一键
type SqlxTransaction ¶
type SqlxTransaction struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.