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.

91 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. // CollectDao is the data access object for table cms_collect.
  11. type CollectDao 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 CollectColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // CollectColumns defines and stores column names for table cms_collect.
  17. type CollectColumns struct {
  18. Id string //
  19. Name string // 资源名
  20. Url string //
  21. Param string // 参数
  22. Model string // 类型
  23. Opt string // 操作方式
  24. Filter string // 过滤模式
  25. FilterForm string //
  26. SyncPic string // 同步图片 全局 2 开启 1 关闭0
  27. Class string // 扩展分类 逗号,分隔
  28. }
  29. // collectColumns holds the columns for table cms_collect.
  30. var collectColumns = CollectColumns{
  31. Id: "id",
  32. Name: "name",
  33. Url: "url",
  34. Param: "param",
  35. Model: "model",
  36. Opt: "opt",
  37. Filter: "filter",
  38. FilterForm: "filter_form",
  39. SyncPic: "sync_pic",
  40. Class: "class",
  41. }
  42. // NewCollectDao creates and returns a new DAO object for table data access.
  43. func NewCollectDao() *CollectDao {
  44. return &CollectDao{
  45. group: "cms",
  46. table: "cms_collect",
  47. columns: collectColumns,
  48. }
  49. }
  50. // DB retrieves and returns the underlying raw database management object of current DAO.
  51. func (dao *CollectDao) DB() gdb.DB {
  52. return g.DB(dao.group)
  53. }
  54. // Table returns the table name of current dao.
  55. func (dao *CollectDao) Table() string {
  56. return dao.table
  57. }
  58. // Columns returns all column names of current dao.
  59. func (dao *CollectDao) Columns() CollectColumns {
  60. return dao.columns
  61. }
  62. // Group returns the configuration group name of database of current dao.
  63. func (dao *CollectDao) Group() string {
  64. return dao.group
  65. }
  66. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  67. func (dao *CollectDao) Ctx(ctx context.Context) *gdb.Model {
  68. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  69. }
  70. // Transaction wraps the transaction logic using function f.
  71. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  72. // It commits the transaction and returns nil if function f returns nil.
  73. //
  74. // Note that, you should not Commit or Rollback the transaction in function f
  75. // as it is automatically handled by this function.
  76. func (dao *CollectDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  77. return dao.Ctx(ctx).Transaction(ctx, f)
  78. }