Skip to content

Commit 5ef4921

Browse files
committed
Use AutoCtx instead of MustCtx
1 parent 8dbc8e9 commit 5ef4921

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/db/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ func WithTx(parentCtx context.Context, f func(ctx context.Context) error) error
123123
return sess.Commit()
124124
}
125125

126-
// MustTx represents executing database operations on a transaction, if the transaction exist,
126+
// AutoTx represents executing database operations on a transaction, if the transaction exist,
127127
// this function will reuse it otherwise will create a new one and close it when finished.
128-
func MustTx(parentCtx context.Context, f func(ctx context.Context) error) error {
128+
func AutoTx(parentCtx context.Context, f func(ctx context.Context) error) error {
129129
if InTransaction(parentCtx) {
130130
return f(newContext(parentCtx, GetEngine(parentCtx), true))
131131
}

0 commit comments

Comments
 (0)