// ========================================================================== // 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" ) // ProductPhotoDao is the manager for logic model data accessing and custom defined data operations functions management. type ProductPhotoDao 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 ProductPhotoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage. } // ProductPhotoColumns defines and stores column names for table product_photo. type ProductPhotoColumns struct { ProductPhotoId string // 商品链接图主键id ProductId string // 商品表id Symbol string // 图片是主图还是详情图标志位 1主图 2轮播图 3,详情图 PhotoUrl string // 商品图片链接 CreatedAt string // 创建时间 CreatPeople string // 创建人 UpdatedAt string // 更新时间 UpdatePeople string // 更新人 } // productPhotoColumns holds the columns for table product_photo. var productPhotoColumns = ProductPhotoColumns{ ProductPhotoId: "product_photo_id", ProductId: "product_id", Symbol: "symbol", PhotoUrl: "photo_url", CreatedAt: "created_at", CreatPeople: "creat_people", UpdatedAt: "updated_at", UpdatePeople: "update_people", } // NewProductPhotoDao creates and returns a new DAO object for table data access. func NewProductPhotoDao() *ProductPhotoDao { return &ProductPhotoDao{ Group: "default", Table: "product_photo", Columns: productPhotoColumns, } } // DB retrieves and returns the underlying raw database management object of current DAO. func (dao *ProductPhotoDao) 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 *ProductPhotoDao) 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 *ProductPhotoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) }