// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gorm.io/gen. DO NOT EDIT. package dao import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "joybuywork/internal/repository/model" ) func newCompanyMade(db *gorm.DB, opts ...gen.DOOption) companyMade { _companyMade := companyMade{} _companyMade.companyMadeDo.UseDB(db, opts...) _companyMade.companyMadeDo.UseModel(&model.CompanyMade{}) tableName := _companyMade.companyMadeDo.TableName() _companyMade.ALL = field.NewAsterisk(tableName) _companyMade.ID = field.NewInt64(tableName, "id") _companyMade.CreatedAt = field.NewInt64(tableName, "created_at") _companyMade.UpdatedAt = field.NewInt64(tableName, "updated_at") _companyMade.CompanyID = field.NewInt64(tableName, "company_id") _companyMade.Mark = field.NewString(tableName, "mark") _companyMade.Params = field.NewString(tableName, "params") _companyMade.fillFieldMap() return _companyMade } type companyMade struct { companyMadeDo companyMadeDo ALL field.Asterisk ID field.Int64 CreatedAt field.Int64 UpdatedAt field.Int64 CompanyID field.Int64 // 企业id Mark field.String // 功能标识 Params field.String // 参数 fieldMap map[string]field.Expr } func (c companyMade) Table(newTableName string) *companyMade { c.companyMadeDo.UseTable(newTableName) return c.updateTableName(newTableName) } func (c companyMade) As(alias string) *companyMade { c.companyMadeDo.DO = *(c.companyMadeDo.As(alias).(*gen.DO)) return c.updateTableName(alias) } func (c *companyMade) updateTableName(table string) *companyMade { c.ALL = field.NewAsterisk(table) c.ID = field.NewInt64(table, "id") c.CreatedAt = field.NewInt64(table, "created_at") c.UpdatedAt = field.NewInt64(table, "updated_at") c.CompanyID = field.NewInt64(table, "company_id") c.Mark = field.NewString(table, "mark") c.Params = field.NewString(table, "params") c.fillFieldMap() return c } func (c *companyMade) WithContext(ctx context.Context) *companyMadeDo { return c.companyMadeDo.WithContext(ctx) } func (c companyMade) TableName() string { return c.companyMadeDo.TableName() } func (c companyMade) Alias() string { return c.companyMadeDo.Alias() } func (c *companyMade) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := c.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (c *companyMade) fillFieldMap() { c.fieldMap = make(map[string]field.Expr, 6) c.fieldMap["id"] = c.ID c.fieldMap["created_at"] = c.CreatedAt c.fieldMap["updated_at"] = c.UpdatedAt c.fieldMap["company_id"] = c.CompanyID c.fieldMap["mark"] = c.Mark c.fieldMap["params"] = c.Params } func (c companyMade) clone(db *gorm.DB) companyMade { c.companyMadeDo.ReplaceConnPool(db.Statement.ConnPool) return c } func (c companyMade) replaceDB(db *gorm.DB) companyMade { c.companyMadeDo.ReplaceDB(db) return c } type companyMadeDo struct{ gen.DO } func (c companyMadeDo) Debug() *companyMadeDo { return c.withDO(c.DO.Debug()) } func (c companyMadeDo) WithContext(ctx context.Context) *companyMadeDo { return c.withDO(c.DO.WithContext(ctx)) } func (c companyMadeDo) ReadDB() *companyMadeDo { return c.Clauses(dbresolver.Read) } func (c companyMadeDo) WriteDB() *companyMadeDo { return c.Clauses(dbresolver.Write) } func (c companyMadeDo) Session(config *gorm.Session) *companyMadeDo { return c.withDO(c.DO.Session(config)) } func (c companyMadeDo) Clauses(conds ...clause.Expression) *companyMadeDo { return c.withDO(c.DO.Clauses(conds...)) } func (c companyMadeDo) Returning(value interface{}, columns ...string) *companyMadeDo { return c.withDO(c.DO.Returning(value, columns...)) } func (c companyMadeDo) Not(conds ...gen.Condition) *companyMadeDo { return c.withDO(c.DO.Not(conds...)) } func (c companyMadeDo) Or(conds ...gen.Condition) *companyMadeDo { return c.withDO(c.DO.Or(conds...)) } func (c companyMadeDo) Select(conds ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Select(conds...)) } func (c companyMadeDo) Where(conds ...gen.Condition) *companyMadeDo { return c.withDO(c.DO.Where(conds...)) } func (c companyMadeDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *companyMadeDo { return c.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (c companyMadeDo) Order(conds ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Order(conds...)) } func (c companyMadeDo) Distinct(cols ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Distinct(cols...)) } func (c companyMadeDo) Omit(cols ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Omit(cols...)) } func (c companyMadeDo) Join(table schema.Tabler, on ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Join(table, on...)) } func (c companyMadeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *companyMadeDo { return c.withDO(c.DO.LeftJoin(table, on...)) } func (c companyMadeDo) RightJoin(table schema.Tabler, on ...field.Expr) *companyMadeDo { return c.withDO(c.DO.RightJoin(table, on...)) } func (c companyMadeDo) Group(cols ...field.Expr) *companyMadeDo { return c.withDO(c.DO.Group(cols...)) } func (c companyMadeDo) Having(conds ...gen.Condition) *companyMadeDo { return c.withDO(c.DO.Having(conds...)) } func (c companyMadeDo) Limit(limit int) *companyMadeDo { return c.withDO(c.DO.Limit(limit)) } func (c companyMadeDo) Offset(offset int) *companyMadeDo { return c.withDO(c.DO.Offset(offset)) } func (c companyMadeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *companyMadeDo { return c.withDO(c.DO.Scopes(funcs...)) } func (c companyMadeDo) Unscoped() *companyMadeDo { return c.withDO(c.DO.Unscoped()) } func (c companyMadeDo) Create(values ...*model.CompanyMade) error { if len(values) == 0 { return nil } return c.DO.Create(values) } func (c companyMadeDo) CreateInBatches(values []*model.CompanyMade, batchSize int) error { return c.DO.CreateInBatches(values, batchSize) } // Save : !!! underlying implementation is different with GORM // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) func (c companyMadeDo) Save(values ...*model.CompanyMade) error { if len(values) == 0 { return nil } return c.DO.Save(values) } func (c companyMadeDo) First() (*model.CompanyMade, error) { if result, err := c.DO.First(); err != nil { return nil, err } else { return result.(*model.CompanyMade), nil } } func (c companyMadeDo) Take() (*model.CompanyMade, error) { if result, err := c.DO.Take(); err != nil { return nil, err } else { return result.(*model.CompanyMade), nil } } func (c companyMadeDo) Last() (*model.CompanyMade, error) { if result, err := c.DO.Last(); err != nil { return nil, err } else { return result.(*model.CompanyMade), nil } } func (c companyMadeDo) Find() ([]*model.CompanyMade, error) { result, err := c.DO.Find() return result.([]*model.CompanyMade), err } func (c companyMadeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.CompanyMade, err error) { buf := make([]*model.CompanyMade, 0, batchSize) err = c.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { defer func() { results = append(results, buf...) }() return fc(tx, batch) }) return results, err } func (c companyMadeDo) FindInBatches(result *[]*model.CompanyMade, batchSize int, fc func(tx gen.Dao, batch int) error) error { return c.DO.FindInBatches(result, batchSize, fc) } func (c companyMadeDo) Attrs(attrs ...field.AssignExpr) *companyMadeDo { return c.withDO(c.DO.Attrs(attrs...)) } func (c companyMadeDo) Assign(attrs ...field.AssignExpr) *companyMadeDo { return c.withDO(c.DO.Assign(attrs...)) } func (c companyMadeDo) Joins(fields ...field.RelationField) *companyMadeDo { for _, _f := range fields { c = *c.withDO(c.DO.Joins(_f)) } return &c } func (c companyMadeDo) Preload(fields ...field.RelationField) *companyMadeDo { for _, _f := range fields { c = *c.withDO(c.DO.Preload(_f)) } return &c } func (c companyMadeDo) FirstOrInit() (*model.CompanyMade, error) { if result, err := c.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.CompanyMade), nil } } func (c companyMadeDo) FirstOrCreate() (*model.CompanyMade, error) { if result, err := c.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.CompanyMade), nil } } func (c companyMadeDo) FindByPage(offset int, limit int) (result []*model.CompanyMade, count int64, err error) { result, err = c.Offset(offset).Limit(limit).Find() if err != nil { return } if size := len(result); 0 < limit && 0 < size && size < limit { count = int64(size + offset) return } count, err = c.Offset(-1).Limit(-1).Count() return } func (c companyMadeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = c.Count() if err != nil { return } err = c.Offset(offset).Limit(limit).Scan(result) return } func (c companyMadeDo) Scan(result interface{}) (err error) { return c.DO.Scan(result) } func (c companyMadeDo) Delete(models ...*model.CompanyMade) (result gen.ResultInfo, err error) { return c.DO.Delete(models) } func (c *companyMadeDo) withDO(do gen.Dao) *companyMadeDo { c.DO = *do.(*gen.DO) return c }