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.

83 lines
2.6 KiB

11 months ago
  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. // HotClassDao is the data access object for table cms_hot_class.
  11. type HotClassDao 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 HotClassColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // HotClassColumns defines and stores column names for table cms_hot_class.
  17. type HotClassColumns struct {
  18. Id string //
  19. TypeName string // 名字
  20. Code string // 代码
  21. Url string // 地址
  22. Param string // 参数
  23. Status string // 状态
  24. }
  25. // hotClassColumns holds the columns for table cms_hot_class.
  26. var hotClassColumns = HotClassColumns{
  27. Id: "id",
  28. TypeName: "type_name",
  29. Code: "code",
  30. Url: "url",
  31. Param: "param",
  32. Status: "status",
  33. }
  34. // NewHotClassDao creates and returns a new DAO object for table data access.
  35. func NewHotClassDao() *HotClassDao {
  36. return &HotClassDao{
  37. group: "cms",
  38. table: "cms_hot_class",
  39. columns: hotClassColumns,
  40. }
  41. }
  42. // DB retrieves and returns the underlying raw database management object of current DAO.
  43. func (dao *HotClassDao) DB() gdb.DB {
  44. return g.DB(dao.group)
  45. }
  46. // Table returns the table name of current dao.
  47. func (dao *HotClassDao) Table() string {
  48. return dao.table
  49. }
  50. // Columns returns all column names of current dao.
  51. func (dao *HotClassDao) Columns() HotClassColumns {
  52. return dao.columns
  53. }
  54. // Group returns the configuration group name of database of current dao.
  55. func (dao *HotClassDao) Group() string {
  56. return dao.group
  57. }
  58. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  59. func (dao *HotClassDao) Ctx(ctx context.Context) *gdb.Model {
  60. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  61. }
  62. // Transaction wraps the transaction logic using function f.
  63. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  64. // It commits the transaction and returns nil if function f returns nil.
  65. //
  66. // Note that, you should not Commit or Rollback the transaction in function f
  67. // as it is automatically handled by this function.
  68. func (dao *HotClassDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  69. return dao.Ctx(ctx).Transaction(ctx, f)
  70. }