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.

109 lines
3.5 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. // ShortVideoDao is the data access object for table cms_short_video.
  11. type ShortVideoDao 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 ShortVideoColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // ShortVideoColumns defines and stores column names for table cms_short_video.
  17. type ShortVideoColumns struct {
  18. Id string //
  19. Title string // 标题
  20. Introduction string //
  21. Tag string // 标签
  22. Author string // 作者
  23. Actor string // 演员
  24. Protagonist string // 主角
  25. Cover string // 封面
  26. CoverUrl string // 封面
  27. ChapterUrls string // 资源地址
  28. ChapterCount string // 当前章节
  29. ChapterMax string // 共人章节
  30. Status string // 状态 0未审核 1更新中 2完结
  31. Views string // 观看次数
  32. Stars string // 标星
  33. CreatedAt string //
  34. UpdatedAt string //
  35. FinishStatus string //
  36. Online string //
  37. }
  38. // shortVideoColumns holds the columns for table cms_short_video.
  39. var shortVideoColumns = ShortVideoColumns{
  40. Id: "id",
  41. Title: "title",
  42. Introduction: "introduction",
  43. Tag: "tag",
  44. Author: "author",
  45. Actor: "actor",
  46. Protagonist: "protagonist",
  47. Cover: "cover",
  48. CoverUrl: "cover_url",
  49. ChapterUrls: "chapter_urls",
  50. ChapterCount: "chapter_count",
  51. ChapterMax: "chapter_max",
  52. Status: "status",
  53. Views: "views",
  54. Stars: "stars",
  55. CreatedAt: "created_at",
  56. UpdatedAt: "updated_at",
  57. FinishStatus: "finish_status",
  58. Online: "online",
  59. }
  60. // NewShortVideoDao creates and returns a new DAO object for table data access.
  61. func NewShortVideoDao() *ShortVideoDao {
  62. return &ShortVideoDao{
  63. group: "cms",
  64. table: "cms_short_video",
  65. columns: shortVideoColumns,
  66. }
  67. }
  68. // DB retrieves and returns the underlying raw database management object of current DAO.
  69. func (dao *ShortVideoDao) DB() gdb.DB {
  70. return g.DB(dao.group)
  71. }
  72. // Table returns the table name of current dao.
  73. func (dao *ShortVideoDao) Table() string {
  74. return dao.table
  75. }
  76. // Columns returns all column names of current dao.
  77. func (dao *ShortVideoDao) Columns() ShortVideoColumns {
  78. return dao.columns
  79. }
  80. // Group returns the configuration group name of database of current dao.
  81. func (dao *ShortVideoDao) Group() string {
  82. return dao.group
  83. }
  84. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  85. func (dao *ShortVideoDao) Ctx(ctx context.Context) *gdb.Model {
  86. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  87. }
  88. // Transaction wraps the transaction logic using function f.
  89. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  90. // It commits the transaction and returns nil if function f returns nil.
  91. //
  92. // Note that, you should not Commit or Rollback the transaction in function f
  93. // as it is automatically handled by this function.
  94. func (dao *ShortVideoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  95. return dao.Ctx(ctx).Transaction(ctx, f)
  96. }