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.

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