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.6 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. // ShortPlayUrlsDao is the data access object for table cms_short_play_urls.
  11. type ShortPlayUrlsDao 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 ShortPlayUrlsColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // ShortPlayUrlsColumns defines and stores column names for table cms_short_play_urls.
  17. type ShortPlayUrlsColumns struct {
  18. Id string //
  19. ShortVideoId string //
  20. Res string //
  21. }
  22. // shortPlayUrlsColumns holds the columns for table cms_short_play_urls.
  23. var shortPlayUrlsColumns = ShortPlayUrlsColumns{
  24. Id: "id",
  25. ShortVideoId: "short_video_id",
  26. Res: "res",
  27. }
  28. // NewShortPlayUrlsDao creates and returns a new DAO object for table data access.
  29. func NewShortPlayUrlsDao() *ShortPlayUrlsDao {
  30. return &ShortPlayUrlsDao{
  31. group: "cms",
  32. table: "cms_short_play_urls",
  33. columns: shortPlayUrlsColumns,
  34. }
  35. }
  36. // DB retrieves and returns the underlying raw database management object of current DAO.
  37. func (dao *ShortPlayUrlsDao) DB() gdb.DB {
  38. return g.DB(dao.group)
  39. }
  40. // Table returns the table name of current dao.
  41. func (dao *ShortPlayUrlsDao) Table() string {
  42. return dao.table
  43. }
  44. // Columns returns all column names of current dao.
  45. func (dao *ShortPlayUrlsDao) Columns() ShortPlayUrlsColumns {
  46. return dao.columns
  47. }
  48. // Group returns the configuration group name of database of current dao.
  49. func (dao *ShortPlayUrlsDao) 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 *ShortPlayUrlsDao) 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 *ShortPlayUrlsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  63. return dao.Ctx(ctx).Transaction(ctx, f)
  64. }