|
- // 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 gen
-
- import (
- "context"
-
- systemroles "github.com/OpenIMSDK/OpenKF/server/internal/models/system_roles"
- "gorm.io/gorm"
- "gorm.io/gorm/clause"
- "gorm.io/gorm/schema"
-
- "gorm.io/gen"
- "gorm.io/gen/field"
-
- "gorm.io/plugin/dbresolver"
- )
-
- func newSysCommunity(db *gorm.DB, opts ...gen.DOOption) sysCommunity {
- _sysCommunity := sysCommunity{}
-
- _sysCommunity.sysCommunityDo.UseDB(db, opts...)
- _sysCommunity.sysCommunityDo.UseModel(&systemroles.SysCommunity{})
-
- tableName := _sysCommunity.sysCommunityDo.TableName()
- _sysCommunity.ALL = field.NewAsterisk(tableName)
- _sysCommunity.Id = field.NewUint(tableName, "id")
- _sysCommunity.CreatedAt = field.NewTime(tableName, "created_at")
- _sysCommunity.UpdatedAt = field.NewTime(tableName, "updated_at")
- _sysCommunity.DeletedAt = field.NewTime(tableName, "deleted_at")
- _sysCommunity.UUID = field.NewString(tableName, "uuid")
- _sysCommunity.Name = field.NewString(tableName, "name")
- _sysCommunity.Email = field.NewString(tableName, "email")
- _sysCommunity.Avatar = field.NewString(tableName, "avatar")
- _sysCommunity.Description = field.NewString(tableName, "description")
-
- _sysCommunity.fillFieldMap()
-
- return _sysCommunity
- }
-
- type sysCommunity struct {
- sysCommunityDo sysCommunityDo
-
- ALL field.Asterisk
- Id field.Uint
- CreatedAt field.Time
- UpdatedAt field.Time
- DeletedAt field.Time
- UUID field.String
- Name field.String
- Email field.String
- Avatar field.String
- Description field.String
-
- fieldMap map[string]field.Expr
- }
-
- func (s sysCommunity) Table(newTableName string) *sysCommunity {
- s.sysCommunityDo.UseTable(newTableName)
- return s.updateTableName(newTableName)
- }
-
- func (s sysCommunity) As(alias string) *sysCommunity {
- s.sysCommunityDo.DO = *(s.sysCommunityDo.As(alias).(*gen.DO))
- return s.updateTableName(alias)
- }
-
- func (s *sysCommunity) updateTableName(table string) *sysCommunity {
- s.ALL = field.NewAsterisk(table)
- s.Id = field.NewUint(table, "id")
- s.CreatedAt = field.NewTime(table, "created_at")
- s.UpdatedAt = field.NewTime(table, "updated_at")
- s.DeletedAt = field.NewTime(table, "deleted_at")
- s.UUID = field.NewString(table, "uuid")
- s.Name = field.NewString(table, "name")
- s.Email = field.NewString(table, "email")
- s.Avatar = field.NewString(table, "avatar")
- s.Description = field.NewString(table, "description")
-
- s.fillFieldMap()
-
- return s
- }
-
- func (s *sysCommunity) WithContext(ctx context.Context) ISysCommunityDo {
- return s.sysCommunityDo.WithContext(ctx)
- }
-
- func (s sysCommunity) TableName() string { return s.sysCommunityDo.TableName() }
-
- func (s sysCommunity) Alias() string { return s.sysCommunityDo.Alias() }
-
- func (s *sysCommunity) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
- _f, ok := s.fieldMap[fieldName]
- if !ok || _f == nil {
- return nil, false
- }
- _oe, ok := _f.(field.OrderExpr)
- return _oe, ok
- }
-
- func (s *sysCommunity) fillFieldMap() {
- s.fieldMap = make(map[string]field.Expr, 9)
- s.fieldMap["id"] = s.Id
- s.fieldMap["created_at"] = s.CreatedAt
- s.fieldMap["updated_at"] = s.UpdatedAt
- s.fieldMap["deleted_at"] = s.DeletedAt
- s.fieldMap["uuid"] = s.UUID
- s.fieldMap["name"] = s.Name
- s.fieldMap["email"] = s.Email
- s.fieldMap["avatar"] = s.Avatar
- s.fieldMap["description"] = s.Description
- }
-
- func (s sysCommunity) clone(db *gorm.DB) sysCommunity {
- s.sysCommunityDo.ReplaceConnPool(db.Statement.ConnPool)
- return s
- }
-
- func (s sysCommunity) replaceDB(db *gorm.DB) sysCommunity {
- s.sysCommunityDo.ReplaceDB(db)
- return s
- }
-
- type sysCommunityDo struct{ gen.DO }
-
- type ISysCommunityDo interface {
- gen.SubQuery
- Debug() ISysCommunityDo
- WithContext(ctx context.Context) ISysCommunityDo
- WithResult(fc func(tx gen.Dao)) gen.ResultInfo
- ReplaceDB(db *gorm.DB)
- ReadDB() ISysCommunityDo
- WriteDB() ISysCommunityDo
- As(alias string) gen.Dao
- Session(config *gorm.Session) ISysCommunityDo
- Columns(cols ...field.Expr) gen.Columns
- Clauses(conds ...clause.Expression) ISysCommunityDo
- Not(conds ...gen.Condition) ISysCommunityDo
- Or(conds ...gen.Condition) ISysCommunityDo
- Select(conds ...field.Expr) ISysCommunityDo
- Where(conds ...gen.Condition) ISysCommunityDo
- Order(conds ...field.Expr) ISysCommunityDo
- Distinct(cols ...field.Expr) ISysCommunityDo
- Omit(cols ...field.Expr) ISysCommunityDo
- Join(table schema.Tabler, on ...field.Expr) ISysCommunityDo
- LeftJoin(table schema.Tabler, on ...field.Expr) ISysCommunityDo
- RightJoin(table schema.Tabler, on ...field.Expr) ISysCommunityDo
- Group(cols ...field.Expr) ISysCommunityDo
- Having(conds ...gen.Condition) ISysCommunityDo
- Limit(limit int) ISysCommunityDo
- Offset(offset int) ISysCommunityDo
- Count() (count int64, err error)
- Scopes(funcs ...func(gen.Dao) gen.Dao) ISysCommunityDo
- Unscoped() ISysCommunityDo
- Create(values ...*systemroles.SysCommunity) error
- CreateInBatches(values []*systemroles.SysCommunity, batchSize int) error
- Save(values ...*systemroles.SysCommunity) error
- First() (*systemroles.SysCommunity, error)
- Take() (*systemroles.SysCommunity, error)
- Last() (*systemroles.SysCommunity, error)
- Find() ([]*systemroles.SysCommunity, error)
- FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*systemroles.SysCommunity, err error)
- FindInBatches(result *[]*systemroles.SysCommunity, batchSize int, fc func(tx gen.Dao, batch int) error) error
- Pluck(column field.Expr, dest interface{}) error
- Delete(...*systemroles.SysCommunity) (info gen.ResultInfo, err error)
- Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
- UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
- Updates(value interface{}) (info gen.ResultInfo, err error)
- UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
- UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
- UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
- UpdateFrom(q gen.SubQuery) gen.Dao
- Attrs(attrs ...field.AssignExpr) ISysCommunityDo
- Assign(attrs ...field.AssignExpr) ISysCommunityDo
- Joins(fields ...field.RelationField) ISysCommunityDo
- Preload(fields ...field.RelationField) ISysCommunityDo
- FirstOrInit() (*systemroles.SysCommunity, error)
- FirstOrCreate() (*systemroles.SysCommunity, error)
- FindByPage(offset int, limit int) (result []*systemroles.SysCommunity, count int64, err error)
- ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
- Scan(result interface{}) (err error)
- Returning(value interface{}, columns ...string) ISysCommunityDo
- UnderlyingDB() *gorm.DB
- schema.Tabler
- }
-
- func (s sysCommunityDo) Debug() ISysCommunityDo {
- return s.withDO(s.DO.Debug())
- }
-
- func (s sysCommunityDo) WithContext(ctx context.Context) ISysCommunityDo {
- return s.withDO(s.DO.WithContext(ctx))
- }
-
- func (s sysCommunityDo) ReadDB() ISysCommunityDo {
- return s.Clauses(dbresolver.Read)
- }
-
- func (s sysCommunityDo) WriteDB() ISysCommunityDo {
- return s.Clauses(dbresolver.Write)
- }
-
- func (s sysCommunityDo) Session(config *gorm.Session) ISysCommunityDo {
- return s.withDO(s.DO.Session(config))
- }
-
- func (s sysCommunityDo) Clauses(conds ...clause.Expression) ISysCommunityDo {
- return s.withDO(s.DO.Clauses(conds...))
- }
-
- func (s sysCommunityDo) Returning(value interface{}, columns ...string) ISysCommunityDo {
- return s.withDO(s.DO.Returning(value, columns...))
- }
-
- func (s sysCommunityDo) Not(conds ...gen.Condition) ISysCommunityDo {
- return s.withDO(s.DO.Not(conds...))
- }
-
- func (s sysCommunityDo) Or(conds ...gen.Condition) ISysCommunityDo {
- return s.withDO(s.DO.Or(conds...))
- }
-
- func (s sysCommunityDo) Select(conds ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Select(conds...))
- }
-
- func (s sysCommunityDo) Where(conds ...gen.Condition) ISysCommunityDo {
- return s.withDO(s.DO.Where(conds...))
- }
-
- func (s sysCommunityDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) ISysCommunityDo {
- return s.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
-
- func (s sysCommunityDo) Order(conds ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Order(conds...))
- }
-
- func (s sysCommunityDo) Distinct(cols ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Distinct(cols...))
- }
-
- func (s sysCommunityDo) Omit(cols ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Omit(cols...))
- }
-
- func (s sysCommunityDo) Join(table schema.Tabler, on ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Join(table, on...))
- }
-
- func (s sysCommunityDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.LeftJoin(table, on...))
- }
-
- func (s sysCommunityDo) RightJoin(table schema.Tabler, on ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.RightJoin(table, on...))
- }
-
- func (s sysCommunityDo) Group(cols ...field.Expr) ISysCommunityDo {
- return s.withDO(s.DO.Group(cols...))
- }
-
- func (s sysCommunityDo) Having(conds ...gen.Condition) ISysCommunityDo {
- return s.withDO(s.DO.Having(conds...))
- }
-
- func (s sysCommunityDo) Limit(limit int) ISysCommunityDo {
- return s.withDO(s.DO.Limit(limit))
- }
-
- func (s sysCommunityDo) Offset(offset int) ISysCommunityDo {
- return s.withDO(s.DO.Offset(offset))
- }
-
- func (s sysCommunityDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISysCommunityDo {
- return s.withDO(s.DO.Scopes(funcs...))
- }
-
- func (s sysCommunityDo) Unscoped() ISysCommunityDo {
- return s.withDO(s.DO.Unscoped())
- }
-
- func (s sysCommunityDo) Create(values ...*systemroles.SysCommunity) error {
- if len(values) == 0 {
- return nil
- }
- return s.DO.Create(values)
- }
-
- func (s sysCommunityDo) CreateInBatches(values []*systemroles.SysCommunity, batchSize int) error {
- return s.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 (s sysCommunityDo) Save(values ...*systemroles.SysCommunity) error {
- if len(values) == 0 {
- return nil
- }
- return s.DO.Save(values)
- }
-
- func (s sysCommunityDo) First() (*systemroles.SysCommunity, error) {
- if result, err := s.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*systemroles.SysCommunity), nil
- }
- }
-
- func (s sysCommunityDo) Take() (*systemroles.SysCommunity, error) {
- if result, err := s.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*systemroles.SysCommunity), nil
- }
- }
-
- func (s sysCommunityDo) Last() (*systemroles.SysCommunity, error) {
- if result, err := s.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*systemroles.SysCommunity), nil
- }
- }
-
- func (s sysCommunityDo) Find() ([]*systemroles.SysCommunity, error) {
- result, err := s.DO.Find()
- return result.([]*systemroles.SysCommunity), err
- }
-
- func (s sysCommunityDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*systemroles.SysCommunity, err error) {
- buf := make([]*systemroles.SysCommunity, 0, batchSize)
- err = s.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 (s sysCommunityDo) FindInBatches(result *[]*systemroles.SysCommunity, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return s.DO.FindInBatches(result, batchSize, fc)
- }
-
- func (s sysCommunityDo) Attrs(attrs ...field.AssignExpr) ISysCommunityDo {
- return s.withDO(s.DO.Attrs(attrs...))
- }
-
- func (s sysCommunityDo) Assign(attrs ...field.AssignExpr) ISysCommunityDo {
- return s.withDO(s.DO.Assign(attrs...))
- }
-
- func (s sysCommunityDo) Joins(fields ...field.RelationField) ISysCommunityDo {
- for _, _f := range fields {
- s = *s.withDO(s.DO.Joins(_f))
- }
- return &s
- }
-
- func (s sysCommunityDo) Preload(fields ...field.RelationField) ISysCommunityDo {
- for _, _f := range fields {
- s = *s.withDO(s.DO.Preload(_f))
- }
- return &s
- }
-
- func (s sysCommunityDo) FirstOrInit() (*systemroles.SysCommunity, error) {
- if result, err := s.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*systemroles.SysCommunity), nil
- }
- }
-
- func (s sysCommunityDo) FirstOrCreate() (*systemroles.SysCommunity, error) {
- if result, err := s.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*systemroles.SysCommunity), nil
- }
- }
-
- func (s sysCommunityDo) FindByPage(offset int, limit int) (result []*systemroles.SysCommunity, count int64, err error) {
- result, err = s.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 = s.Offset(-1).Limit(-1).Count()
- return
- }
-
- func (s sysCommunityDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
- count, err = s.Count()
- if err != nil {
- return
- }
-
- err = s.Offset(offset).Limit(limit).Scan(result)
- return
- }
-
- func (s sysCommunityDo) Scan(result interface{}) (err error) {
- return s.DO.Scan(result)
- }
-
- func (s sysCommunityDo) Delete(models ...*systemroles.SysCommunity) (result gen.ResultInfo, err error) {
- return s.DO.Delete(models)
- }
-
- func (s *sysCommunityDo) withDO(do gen.Dao) *sysCommunityDo {
- s.DO = *do.(*gen.DO)
- return s
- }
|