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.7 KiB

9 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. // VideoBindDao is the data access object for table cms_video_bind.
  11. type VideoBindDao 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 VideoBindColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // VideoBindColumns defines and stores column names for table cms_video_bind.
  17. type VideoBindColumns struct {
  18. Id string //
  19. VideoId string // 视频编号
  20. CollectId string // 资源站编号
  21. SourceId string // 原始编号
  22. CreatedAt string //
  23. UpdatedAt string //
  24. }
  25. // videoBindColumns holds the columns for table cms_video_bind.
  26. var videoBindColumns = VideoBindColumns{
  27. Id: "id",
  28. VideoId: "video_id",
  29. CollectId: "collect_id",
  30. SourceId: "source_id",
  31. CreatedAt: "created_at",
  32. UpdatedAt: "updated_at",
  33. }
  34. // NewVideoBindDao creates and returns a new DAO object for table data access.
  35. func NewVideoBindDao() *VideoBindDao {
  36. return &VideoBindDao{
  37. group: "cms",
  38. table: "cms_video_bind",
  39. columns: videoBindColumns,
  40. }
  41. }
  42. // DB retrieves and returns the underlying raw database management object of current DAO.
  43. func (dao *VideoBindDao) DB() gdb.DB {
  44. return g.DB(dao.group)
  45. }
  46. // Table returns the table name of current dao.
  47. func (dao *VideoBindDao) Table() string {
  48. return dao.table
  49. }
  50. // Columns returns all column names of current dao.
  51. func (dao *VideoBindDao) Columns() VideoBindColumns {
  52. return dao.columns
  53. }
  54. // Group returns the configuration group name of database of current dao.
  55. func (dao *VideoBindDao) 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 *VideoBindDao) 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 *VideoBindDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  69. return dao.Ctx(ctx).Transaction(ctx, f)
  70. }