task_reward.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. // TaskRewardDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type TaskRewardDao struct {
  12. Table string // Table is the underlying table name of the DAO.
  13. Group string // Group is the database configuration group name of current DAO.
  14. Columns TaskRewardColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // TaskRewardColumns defines and stores column names for table task_reward.
  17. type TaskRewardColumns struct {
  18. RewardId string //
  19. IsRewardGoods string // 是否奖励实物
  20. RewardGoodsInfo string // 实物奖励信息
  21. IsPaymentArticle string // 是否获得稿费
  22. PaymentValue string // 稿费金额描述
  23. OtherRewardInfo string // 其他奖励信息
  24. TaskBaseId string // 关联的task_base_info的id
  25. }
  26. // taskRewardColumns holds the columns for table task_reward.
  27. var taskRewardColumns = TaskRewardColumns{
  28. RewardId: "reward_id",
  29. IsRewardGoods: "is_reward_goods",
  30. RewardGoodsInfo: "reward_goods_info",
  31. IsPaymentArticle: "is_payment_article",
  32. PaymentValue: "payment_value",
  33. OtherRewardInfo: "other_reward_info",
  34. TaskBaseId: "task_base_id",
  35. }
  36. // NewTaskRewardDao creates and returns a new DAO object for table data access.
  37. func NewTaskRewardDao() *TaskRewardDao {
  38. return &TaskRewardDao{
  39. Group: "default",
  40. Table: "task_reward",
  41. Columns: taskRewardColumns,
  42. }
  43. }
  44. // DB retrieves and returns the underlying raw database management object of current DAO.
  45. func (dao *TaskRewardDao) DB() gdb.DB {
  46. return g.DB(dao.Group)
  47. }
  48. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  49. func (dao *TaskRewardDao) Ctx(ctx context.Context) *gdb.Model {
  50. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  51. }
  52. // Transaction wraps the transaction logic using function f.
  53. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  54. // It commits the transaction and returns nil if function f returns nil.
  55. //
  56. // Note that, you should not Commit or Rollback the transaction in function f
  57. // as it is automatically handled by this function.
  58. func (dao *TaskRewardDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  59. return dao.Ctx(ctx).Transaction(ctx, f)
  60. }