younggee_product.go 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. // YounggeeProductDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type YounggeeProductDao 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 YounggeeProductColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // YounggeeProductColumns defines and stores column names for table younggee_product.
  17. type YounggeeProductColumns struct {
  18. ProductId string // 商品id
  19. ProductName string // 商品名称
  20. ProductType string // 商品类型
  21. ShopAddress string // 店铺地址,商品类型为线下品牌时需填写
  22. ProductPrice string // 商品价值
  23. ProductDetail string //
  24. ProductUrl string // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
  25. EnterpriseId string // 所属企业id
  26. CreatedAt string // 创建时间
  27. UpdatedAt string // 更新时间
  28. BrandName string //
  29. }
  30. // younggeeProductColumns holds the columns for table younggee_product.
  31. var younggeeProductColumns = YounggeeProductColumns{
  32. ProductId: "product_id",
  33. ProductName: "product_name",
  34. ProductType: "product_type",
  35. ShopAddress: "shop_address",
  36. ProductPrice: "product_price",
  37. ProductDetail: "product_detail",
  38. ProductUrl: "product_url",
  39. EnterpriseId: "enterprise_id",
  40. CreatedAt: "created_at",
  41. UpdatedAt: "updated_at",
  42. BrandName: "brand_name",
  43. }
  44. // NewYounggeeProductDao creates and returns a new DAO object for table data access.
  45. func NewYounggeeProductDao() *YounggeeProductDao {
  46. return &YounggeeProductDao{
  47. Group: "default",
  48. Table: "younggee_product",
  49. Columns: younggeeProductColumns,
  50. }
  51. }
  52. // DB retrieves and returns the underlying raw database management object of current DAO.
  53. func (dao *YounggeeProductDao) DB() gdb.DB {
  54. return g.DB(dao.Group)
  55. }
  56. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  57. func (dao *YounggeeProductDao) Ctx(ctx context.Context) *gdb.Model {
  58. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  59. }
  60. // Transaction wraps the transaction logic using function f.
  61. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  62. // It commits the transaction and returns nil if function f returns nil.
  63. //
  64. // Note that, you should not Commit or Rollback the transaction in function f
  65. // as it is automatically handled by this function.
  66. func (dao *YounggeeProductDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  67. return dao.Ctx(ctx).Transaction(ctx, f)
  68. }