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.

95 lines
2.9 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. // PlayerDao is the data access object for table cms_player.
  11. type PlayerDao 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 PlayerColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // PlayerColumns defines and stores column names for table cms_player.
  17. type PlayerColumns struct {
  18. Id string //
  19. Status string // 状态
  20. From string // 编码格式
  21. Name string // 名称
  22. Target string // 目标窗口
  23. Parse string // 解析状态
  24. ParseApi string // 解析地址
  25. Sort string // 排序
  26. Tip string // 提示
  27. Filename string // 文件名称
  28. Code string // 编码
  29. Remark string // 备注
  30. }
  31. // playerColumns holds the columns for table cms_player.
  32. var playerColumns = PlayerColumns{
  33. Id: "id",
  34. Status: "status",
  35. From: "from",
  36. Name: "name",
  37. Target: "target",
  38. Parse: "parse",
  39. ParseApi: "parse_api",
  40. Sort: "sort",
  41. Tip: "tip",
  42. Filename: "filename",
  43. Code: "code",
  44. Remark: "remark",
  45. }
  46. // NewPlayerDao creates and returns a new DAO object for table data access.
  47. func NewPlayerDao() *PlayerDao {
  48. return &PlayerDao{
  49. group: "cms",
  50. table: "cms_player",
  51. columns: playerColumns,
  52. }
  53. }
  54. // DB retrieves and returns the underlying raw database management object of current DAO.
  55. func (dao *PlayerDao) DB() gdb.DB {
  56. return g.DB(dao.group)
  57. }
  58. // Table returns the table name of current dao.
  59. func (dao *PlayerDao) Table() string {
  60. return dao.table
  61. }
  62. // Columns returns all column names of current dao.
  63. func (dao *PlayerDao) Columns() PlayerColumns {
  64. return dao.columns
  65. }
  66. // Group returns the configuration group name of database of current dao.
  67. func (dao *PlayerDao) Group() string {
  68. return dao.group
  69. }
  70. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  71. func (dao *PlayerDao) Ctx(ctx context.Context) *gdb.Model {
  72. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  73. }
  74. // Transaction wraps the transaction logic using function f.
  75. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  76. // It commits the transaction and returns nil if function f returns nil.
  77. //
  78. // Note that, you should not Commit or Rollback the transaction in function f
  79. // as it is automatically handled by this function.
  80. func (dao *PlayerDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  81. return dao.Ctx(ctx).Transaction(ctx, f)
  82. }