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.

77 lines
2.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. // VideoUrlDao is the data access object for table cms_video_url.
  11. type VideoUrlDao 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 VideoUrlColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // VideoUrlColumns defines and stores column names for table cms_video_url.
  17. type VideoUrlColumns struct {
  18. Id string //
  19. VideoId string //
  20. Info string //
  21. }
  22. // videoUrlColumns holds the columns for table cms_video_url.
  23. var videoUrlColumns = VideoUrlColumns{
  24. Id: "id",
  25. VideoId: "video_id",
  26. Info: "info",
  27. }
  28. // NewVideoUrlDao creates and returns a new DAO object for table data access.
  29. func NewVideoUrlDao() *VideoUrlDao {
  30. return &VideoUrlDao{
  31. group: "cms",
  32. table: "cms_video_url",
  33. columns: videoUrlColumns,
  34. }
  35. }
  36. // DB retrieves and returns the underlying raw database management object of current DAO.
  37. func (dao *VideoUrlDao) DB() gdb.DB {
  38. return g.DB(dao.group)
  39. }
  40. // Table returns the table name of current dao.
  41. func (dao *VideoUrlDao) Table() string {
  42. return dao.table
  43. }
  44. // Columns returns all column names of current dao.
  45. func (dao *VideoUrlDao) Columns() VideoUrlColumns {
  46. return dao.columns
  47. }
  48. // Group returns the configuration group name of database of current dao.
  49. func (dao *VideoUrlDao) Group() string {
  50. return dao.group
  51. }
  52. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  53. func (dao *VideoUrlDao) Ctx(ctx context.Context) *gdb.Model {
  54. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  55. }
  56. // Transaction wraps the transaction logic using function f.
  57. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  58. // It commits the transaction and returns nil if function f returns nil.
  59. //
  60. // Note that, you should not Commit or Rollback the transaction in function f
  61. // as it is automatically handled by this function.
  62. func (dao *VideoUrlDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  63. return dao.Ctx(ctx).Transaction(ctx, f)
  64. }