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.

83 lines
2.7 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. // SiteGroupDao is the data access object for table cms_site_group.
  11. type SiteGroupDao 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 SiteGroupColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // SiteGroupColumns defines and stores column names for table cms_site_group.
  17. type SiteGroupColumns struct {
  18. Id string // 主键
  19. CreatedAt string // 创建时间
  20. UpdatedAt string // 更新时间
  21. Name string // 分类名称
  22. Remark string // 备注
  23. Sort string // 排序
  24. }
  25. // siteGroupColumns holds the columns for table cms_site_group.
  26. var siteGroupColumns = SiteGroupColumns{
  27. Id: "id",
  28. CreatedAt: "created_at",
  29. UpdatedAt: "updated_at",
  30. Name: "name",
  31. Remark: "remark",
  32. Sort: "sort",
  33. }
  34. // NewSiteGroupDao creates and returns a new DAO object for table data access.
  35. func NewSiteGroupDao() *SiteGroupDao {
  36. return &SiteGroupDao{
  37. group: "cms",
  38. table: "cms_site_group",
  39. columns: siteGroupColumns,
  40. }
  41. }
  42. // DB retrieves and returns the underlying raw database management object of current DAO.
  43. func (dao *SiteGroupDao) DB() gdb.DB {
  44. return g.DB(dao.group)
  45. }
  46. // Table returns the table name of current dao.
  47. func (dao *SiteGroupDao) Table() string {
  48. return dao.table
  49. }
  50. // Columns returns all column names of current dao.
  51. func (dao *SiteGroupDao) Columns() SiteGroupColumns {
  52. return dao.columns
  53. }
  54. // Group returns the configuration group name of database of current dao.
  55. func (dao *SiteGroupDao) Group() string {
  56. return dao.group
  57. }
  58. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  59. func (dao *SiteGroupDao) Ctx(ctx context.Context) *gdb.Model {
  60. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  61. }
  62. // Transaction wraps the transaction logic using function f.
  63. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  64. // It commits the transaction and returns nil if function f returns nil.
  65. //
  66. // Note that, you should not Commit or Rollback the transaction in function f
  67. // as it is automatically handled by this function.
  68. func (dao *SiteGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  69. return dao.Ctx(ctx).Transaction(ctx, f)
  70. }