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.

89 lines
2.7 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. // HotVideoDao is the data access object for table cms_hot_video.
  11. type HotVideoDao 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 HotVideoColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // HotVideoColumns defines and stores column names for table cms_hot_video.
  17. type HotVideoColumns struct {
  18. Id string //
  19. ClassId string //
  20. VodName string //
  21. VodPic string //
  22. VodTime string //
  23. Score string //
  24. CreatedAt string //
  25. UpdatedAt string //
  26. DeletedAt string //
  27. }
  28. // hotVideoColumns holds the columns for table cms_hot_video.
  29. var hotVideoColumns = HotVideoColumns{
  30. Id: "id",
  31. ClassId: "class_id",
  32. VodName: "vod_name",
  33. VodPic: "vod_pic",
  34. VodTime: "vod_time",
  35. Score: "score",
  36. CreatedAt: "created_at",
  37. UpdatedAt: "updated_at",
  38. DeletedAt: "deleted_at",
  39. }
  40. // NewHotVideoDao creates and returns a new DAO object for table data access.
  41. func NewHotVideoDao() *HotVideoDao {
  42. return &HotVideoDao{
  43. group: "cms",
  44. table: "cms_hot_video",
  45. columns: hotVideoColumns,
  46. }
  47. }
  48. // DB retrieves and returns the underlying raw database management object of current DAO.
  49. func (dao *HotVideoDao) DB() gdb.DB {
  50. return g.DB(dao.group)
  51. }
  52. // Table returns the table name of current dao.
  53. func (dao *HotVideoDao) Table() string {
  54. return dao.table
  55. }
  56. // Columns returns all column names of current dao.
  57. func (dao *HotVideoDao) Columns() HotVideoColumns {
  58. return dao.columns
  59. }
  60. // Group returns the configuration group name of database of current dao.
  61. func (dao *HotVideoDao) Group() string {
  62. return dao.group
  63. }
  64. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  65. func (dao *HotVideoDao) Ctx(ctx context.Context) *gdb.Model {
  66. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  67. }
  68. // Transaction wraps the transaction logic using function f.
  69. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  70. // It commits the transaction and returns nil if function f returns nil.
  71. //
  72. // Note that, you should not Commit or Rollback the transaction in function f
  73. // as it is automatically handled by this function.
  74. func (dao *HotVideoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  75. return dao.Ctx(ctx).Transaction(ctx, f)
  76. }