This commit is contained in:
withchao 2023-11-22 14:43:02 +08:00
parent dbeeb6d2b1
commit 73d404d384

View File

@ -21,6 +21,7 @@ func (m *mongoTx) Transaction(ctx context.Context, fn func(ctx context.Context)
if err != nil {
return err
}
defer sess.EndSession(ctx)
_, err = sess.WithTransaction(ctx, func(ctx mongo.SessionContext) (interface{}, error) {
return nil, fn(ctx)
})