1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- // ==========================================================================
- // Code generated by GoFrame CLI tool. DO NOT EDIT.
- // ==========================================================================
- package internal
- import (
- "context"
- "github.com/gogf/gf/database/gdb"
- "github.com/gogf/gf/frame/g"
- )
- // YounggeeProductDao is the manager for logic model data accessing and custom defined data operations functions management.
- type YounggeeProductDao struct {
- Table string // Table is the underlying table name of the DAO.
- Group string // Group is the database configuration group name of current DAO.
- Columns YounggeeProductColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
- }
- // YounggeeProductColumns defines and stores column names for table younggee_product.
- type YounggeeProductColumns struct {
- ProductId string // 商品id
- ProductName string // 商品名称
- ProductType string // 商品类型
- ShopAddress string // 店铺地址,商品类型为线下品牌时需填写
- ProductPrice string // 商品价值
- ProductDetail string //
- ProductUrl string // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
- EnterpriseId string // 所属企业id
- CreatedAt string // 创建时间
- UpdatedAt string // 更新时间
- BrandName string //
- }
- // younggeeProductColumns holds the columns for table younggee_product.
- var younggeeProductColumns = YounggeeProductColumns{
- ProductId: "product_id",
- ProductName: "product_name",
- ProductType: "product_type",
- ShopAddress: "shop_address",
- ProductPrice: "product_price",
- ProductDetail: "product_detail",
- ProductUrl: "product_url",
- EnterpriseId: "enterprise_id",
- CreatedAt: "created_at",
- UpdatedAt: "updated_at",
- BrandName: "brand_name",
- }
- // NewYounggeeProductDao creates and returns a new DAO object for table data access.
- func NewYounggeeProductDao() *YounggeeProductDao {
- return &YounggeeProductDao{
- Group: "default",
- Table: "younggee_product",
- Columns: younggeeProductColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of current DAO.
- func (dao *YounggeeProductDao) DB() gdb.DB {
- return g.DB(dao.Group)
- }
- // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
- func (dao *YounggeeProductDao) Ctx(ctx context.Context) *gdb.Model {
- return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
- }
- // Transaction wraps the transaction logic using function f.
- // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
- // It commits the transaction and returns nil if function f returns nil.
- //
- // Note that, you should not Commit or Rollback the transaction in function f
- // as it is automatically handled by this function.
- func (dao *YounggeeProductDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|