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