// ========================================================================== // 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" ) // BrandDao is the manager for logic model data accessing and custom defined data operations functions management. type BrandDao 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 BrandColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage. } // BrandColumns defines and stores column names for table brand. type BrandColumns struct { BrandId string // 品牌信息id BrandName string // 品牌名称 BrandLogo string // 品牌logo链接地址 BrandInfo string // 品牌信息简介 BrandPerson string // 品牌对接人 BrandContact string // 品牌对接人联系方式 BrandTitle string // 品牌对接人职称 CreatedAt string // 创建时间 CreatPeople string // 创建人 UpdatedAt string // 更新时间 UpdatePeople string // 更新人 } // brandColumns holds the columns for table brand. var brandColumns = BrandColumns{ BrandId: "brand_id", BrandName: "brand_name", BrandLogo: "brand_logo", BrandInfo: "brand_info", BrandPerson: "brand_person", BrandContact: "brand_contact", BrandTitle: "brand_title", CreatedAt: "created_at", CreatPeople: "creat_people", UpdatedAt: "updated_at", UpdatePeople: "update_people", } // NewBrandDao creates and returns a new DAO object for table data access. func NewBrandDao() *BrandDao { return &BrandDao{ Group: "default", Table: "brand", Columns: brandColumns, } } // DB retrieves and returns the underlying raw database management object of current DAO. func (dao *BrandDao) 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 *BrandDao) 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 *BrandDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) }