// Package dao 通知模块与自动任务模块数据访问(主库默认分组,手写)。 package dao import ( "context" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" ) // noticeModel 主库通用模型构造。 func noticeModel(table string) func(ctx context.Context) *gdb.Model { return func(ctx context.Context) *gdb.Model { return g.DB().Model(table).Safe() } } type noticeChannelDao struct{ table string } // NoticeChannel 通知渠道表访问对象。 var NoticeChannel = noticeChannelDao{table: "notice_channel"} func (d noticeChannelDao) Ctx(ctx context.Context) *gdb.Model { return noticeModel(d.table)(ctx) } type noticeRuleDao struct{ table string } // NoticeRule 通知规则表访问对象。 var NoticeRule = noticeRuleDao{table: "notice_rule"} func (d noticeRuleDao) Ctx(ctx context.Context) *gdb.Model { return noticeModel(d.table)(ctx) } type noticeLogDao struct{ table string } // NoticeLog 通知记录表访问对象。 var NoticeLog = noticeLogDao{table: "notice_log"} func (d noticeLogDao) Ctx(ctx context.Context) *gdb.Model { return noticeModel(d.table)(ctx) } type autoJobDao struct{ table string } // AutoJob 自动任务定义表访问对象。 var AutoJob = autoJobDao{table: "auto_job"} func (d autoJobDao) Ctx(ctx context.Context) *gdb.Model { return noticeModel(d.table)(ctx) } type autoJobLogDao struct{ table string } // AutoJobLog 自动任务运行日志表访问对象。 var AutoJobLog = autoJobLogDao{table: "auto_job_log"} func (d autoJobLogDao) Ctx(ctx context.Context) *gdb.Model { return noticeModel(d.table)(ctx) }