1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // ==========================================================================
- // 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"
- )
- // InfoProductClassifyDao is the manager for logic model data accessing and custom defined data operations functions management.
- type InfoProductClassifyDao 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 InfoProductClassifyColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
- }
- // InfoProductClassifyColumns defines and stores column names for table info_product_classify.
- type InfoProductClassifyColumns struct {
- ClassifyId string // 分类id
- Classify string // 分类名
- }
- // infoProductClassifyColumns holds the columns for table info_product_classify.
- var infoProductClassifyColumns = InfoProductClassifyColumns{
- ClassifyId: "classify_id",
- Classify: "classify",
- }
- // NewInfoProductClassifyDao creates and returns a new DAO object for table data access.
- func NewInfoProductClassifyDao() *InfoProductClassifyDao {
- return &InfoProductClassifyDao{
- Group: "default",
- Table: "info_product_classify",
- Columns: infoProductClassifyColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of current DAO.
- func (dao *InfoProductClassifyDao) 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 *InfoProductClassifyDao) 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 *InfoProductClassifyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|