You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.0 KiB

  1. // ==========================================================================
  2. // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/v2/database/gdb"
  8. "github.com/gogf/gf/v2/frame/g"
  9. )
  10. // FloatWindowDao is the data access object for table float_window.
  11. type FloatWindowDao 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 FloatWindowColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // FloatWindowColumns defines and stores column names for table float_window.
  17. type FloatWindowColumns struct {
  18. Id string // 自增id
  19. Title string // 标题
  20. Icon string // 图标
  21. Start string // 开始日期
  22. End string // 结束日期
  23. Url string // 活动地址
  24. Markets string // 市场 my,sg,th,vi,can,hk
  25. MemberLimit string // 用户权限 1:非网 2:半年版 3:终免
  26. CreatedAt string //
  27. UpdatedAt string //
  28. }
  29. // floatWindowColumns holds the columns for table float_window.
  30. var floatWindowColumns = FloatWindowColumns{
  31. Id: "id",
  32. Title: "title",
  33. Icon: "icon",
  34. Start: "start",
  35. End: "end",
  36. Url: "url",
  37. Markets: "markets",
  38. MemberLimit: "member_limit",
  39. CreatedAt: "created_at",
  40. UpdatedAt: "updated_at",
  41. }
  42. // NewFloatWindowDao creates and returns a new DAO object for table data access.
  43. func NewFloatWindowDao() *FloatWindowDao {
  44. return &FloatWindowDao{
  45. group: "default",
  46. table: "float_window",
  47. columns: floatWindowColumns,
  48. }
  49. }
  50. // DB retrieves and returns the underlying raw database management object of current DAO.
  51. func (dao *FloatWindowDao) DB() gdb.DB {
  52. return g.DB(dao.group)
  53. }
  54. // Table returns the table name of current dao.
  55. func (dao *FloatWindowDao) Table() string {
  56. return dao.table
  57. }
  58. // Columns returns all column names of current dao.
  59. func (dao *FloatWindowDao) Columns() FloatWindowColumns {
  60. return dao.columns
  61. }
  62. // Group returns the configuration group name of database of current dao.
  63. func (dao *FloatWindowDao) Group() string {
  64. return dao.group
  65. }
  66. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  67. func (dao *FloatWindowDao) Ctx(ctx context.Context) *gdb.Model {
  68. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  69. }
  70. // Transaction wraps the transaction logic using function f.
  71. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  72. // It commits the transaction and returns nil if function f returns nil.
  73. //
  74. // Note that, you should not Commit or Rollback the transaction in function f
  75. // as it is automatically handled by this function.
  76. func (dao *FloatWindowDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  77. return dao.Ctx(ctx).Transaction(ctx, f)
  78. }