Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
qloog authored Feb 27, 2025
1 parent 01beba6 commit d004911
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/dal/db/model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *greeterRepo) Update(ctx context.Context, g *model.Greeter) (*model.Gree

## 方式二: 使用 `gorm/gen` 事务

gorm/gen 生成的代码中,没有使用事务,需要手动添加事务支持。
`repo` 层里,使用 `gorm/gen` 生成的代码,使用 `Transaction` 手动添加事务支持

```go
import (
Expand Down Expand Up @@ -89,4 +89,5 @@ func doSomething(ctx context.Context, id int64, data model.UserInfoModel) error

## References

- https://gorm.io/gen/transaction.html
- https://juejin.cn/post/7399984522094149659?share_token=B3E5040F-3BC1-481A-A700-AFCF37F124BC

0 comments on commit d004911

Please sign in to comment.