收口审计治理与套餐任务进展
Constraint: 在线热修前必须保存当前迭代分支全部有效代码进展 Confidence: medium Scope-risk: broad Directive: 后续修改需保持审计事件与业务事务边界一致 Tested: git diff --cached --check Not-tested: 未运行全量测试,提交用于切换分支前保存既有工作
This commit is contained in:
@@ -17,6 +17,16 @@ func NewCarrierStore(db *gorm.DB) *CarrierStore {
|
||||
return &CarrierStore{db: db}
|
||||
}
|
||||
|
||||
// WithTx 返回复用当前事务的运营商 Store。
|
||||
func (s *CarrierStore) WithTx(tx *gorm.DB) *CarrierStore {
|
||||
return &CarrierStore{db: tx}
|
||||
}
|
||||
|
||||
// DB 返回底层数据库连接,用于业务事实与审计同事务提交。
|
||||
func (s *CarrierStore) DB() *gorm.DB {
|
||||
return s.db
|
||||
}
|
||||
|
||||
func (s *CarrierStore) Create(ctx context.Context, carrier *model.Carrier) error {
|
||||
return s.db.WithContext(ctx).Create(carrier).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user