voucher/internal/data
ziming be2adefb91 切换主体 2026-03-27 16:47:13 +08:00
..
mixrepoimpl 多笔立减金 2025-12-11 14:40:12 +08:00
model 多笔立减金 2025-12-19 15:23:54 +08:00
repoimpl 切换主体 2026-03-27 16:47:13 +08:00
wechatrepoimpl Merge branch 'pro' into dev 2026-03-27 14:52:58 +08:00
README.md init 2025-03-03 14:49:28 +08:00
db.go ctx 2025-03-26 15:06:19 +08:00
gorm.go order by 2025-10-16 12:01:26 +08:00
gorm_test.go test 2025-03-26 16:24:49 +08:00
mq.go cmb 2025-03-07 16:28:59 +08:00
mq_test.go "2006-01-02 15:04:05.000" 批次查询接口时间调整 2025-04-14 15:18:58 +08:00
provider_set.go 多笔立减 2025-08-11 10:04:46 +08:00
rds.go redis db 2025-03-20 14:30:47 +08:00
wechat.go 多笔立减 2025-08-11 10:15:39 +08:00
wechat_test.go test 2025-04-22 17:52:30 +08:00
wx.go 切换主体 2026-03-25 14:08:29 +08:00
wx_test.go 多笔立减 2025-08-11 10:04:46 +08:00

README.md

Data

与外部交互的基础层:包含 数据库、Redis、MQ 等

如何编写数据库的dao

  1. 注入 data *Data
  2. 获取 Db 对象时,禁止直接取属性,必须使用 GetDb 方法,此方法解析了上下文 Context 中是否开启了事务

事务的使用

var err error
err = Exec(ctx, func(ctx context.Context) error {
    err = GoodsCreate(ctx)
    if err != nil {
        return err
    }
    return GoodsCashCreate(ctx)
})