// 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 query import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "gadmin/internal/gorm/model" ) func newUserAccount(db *gorm.DB, opts ...gen.DOOption) userAccount { _userAccount := userAccount{} _userAccount.userAccountDo.UseDB(db, opts...) _userAccount.userAccountDo.UseModel(&model.UserAccount{}) tableName := _userAccount.userAccountDo.TableName() _userAccount.ALL = field.NewAsterisk(tableName) _userAccount.ID = field.NewInt64(tableName, "id") _userAccount.AccID = field.NewInt64(tableName, "accId") _userAccount.Openid = field.NewString(tableName, "openid") _userAccount.Nickname = field.NewString(tableName, "nickname") _userAccount.Avatar = field.NewString(tableName, "avatar") _userAccount.Account = field.NewString(tableName, "account") _userAccount.Password = field.NewString(tableName, "password") _userAccount.Inviter = field.NewInt64(tableName, "inviter") _userAccount.Createtime = field.NewInt64(tableName, "createtime") _userAccount.Platopenid = field.NewString(tableName, "platopenid") _userAccount.Channel = field.NewInt32(tableName, "channel") _userAccount.Picture = field.NewInt32(tableName, "picture") _userAccount.Idcard = field.NewString(tableName, "idcard") _userAccount.Name = field.NewString(tableName, "name") _userAccount.Borntime = field.NewInt64(tableName, "borntime") _userAccount.Gametime = field.NewInt64(tableName, "gametime") _userAccount.Gametimelen = field.NewInt32(tableName, "gametimelen") _userAccount.Sessionkey = field.NewString(tableName, "sessionkey") _userAccount.Unionid = field.NewString(tableName, "unionid") _userAccount.Server = field.NewInt32(tableName, "server") _userAccount.Summary = field.NewString(tableName, "summary") _userAccount.Ban = field.NewInt32(tableName, "ban") _userAccount.GdtVid = field.NewString(tableName, "gdtVid") _userAccount.AID = field.NewString(tableName, "aId") _userAccount.Flag = field.NewInt32(tableName, "flag") _userAccount.AdSrc = field.NewString(tableName, "adSrc") _userAccount.fillFieldMap() return _userAccount } type userAccount struct { userAccountDo ALL field.Asterisk ID field.Int64 AccID field.Int64 Openid field.String Nickname field.String Avatar field.String Account field.String Password field.String Inviter field.Int64 Createtime field.Int64 Platopenid field.String Channel field.Int32 Picture field.Int32 Idcard field.String Name field.String Borntime field.Int64 Gametime field.Int64 Gametimelen field.Int32 Sessionkey field.String Unionid field.String Server field.Int32 Summary field.String Ban field.Int32 GdtVid field.String AID field.String Flag field.Int32 AdSrc field.String fieldMap map[string]field.Expr } func (u userAccount) Table(newTableName string) *userAccount { u.userAccountDo.UseTable(newTableName) return u.updateTableName(newTableName) } func (u userAccount) As(alias string) *userAccount { u.userAccountDo.DO = *(u.userAccountDo.As(alias).(*gen.DO)) return u.updateTableName(alias) } func (u *userAccount) updateTableName(table string) *userAccount { u.ALL = field.NewAsterisk(table) u.ID = field.NewInt64(table, "id") u.AccID = field.NewInt64(table, "accId") u.Openid = field.NewString(table, "openid") u.Nickname = field.NewString(table, "nickname") u.Avatar = field.NewString(table, "avatar") u.Account = field.NewString(table, "account") u.Password = field.NewString(table, "password") u.Inviter = field.NewInt64(table, "inviter") u.Createtime = field.NewInt64(table, "createtime") u.Platopenid = field.NewString(table, "platopenid") u.Channel = field.NewInt32(table, "channel") u.Picture = field.NewInt32(table, "picture") u.Idcard = field.NewString(table, "idcard") u.Name = field.NewString(table, "name") u.Borntime = field.NewInt64(table, "borntime") u.Gametime = field.NewInt64(table, "gametime") u.Gametimelen = field.NewInt32(table, "gametimelen") u.Sessionkey = field.NewString(table, "sessionkey") u.Unionid = field.NewString(table, "unionid") u.Server = field.NewInt32(table, "server") u.Summary = field.NewString(table, "summary") u.Ban = field.NewInt32(table, "ban") u.GdtVid = field.NewString(table, "gdtVid") u.AID = field.NewString(table, "aId") u.Flag = field.NewInt32(table, "flag") u.AdSrc = field.NewString(table, "adSrc") u.fillFieldMap() return u } func (u *userAccount) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := u.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (u *userAccount) fillFieldMap() { u.fieldMap = make(map[string]field.Expr, 26) u.fieldMap["id"] = u.ID u.fieldMap["accId"] = u.AccID u.fieldMap["openid"] = u.Openid u.fieldMap["nickname"] = u.Nickname u.fieldMap["avatar"] = u.Avatar u.fieldMap["account"] = u.Account u.fieldMap["password"] = u.Password u.fieldMap["inviter"] = u.Inviter u.fieldMap["createtime"] = u.Createtime u.fieldMap["platopenid"] = u.Platopenid u.fieldMap["channel"] = u.Channel u.fieldMap["picture"] = u.Picture u.fieldMap["idcard"] = u.Idcard u.fieldMap["name"] = u.Name u.fieldMap["borntime"] = u.Borntime u.fieldMap["gametime"] = u.Gametime u.fieldMap["gametimelen"] = u.Gametimelen u.fieldMap["sessionkey"] = u.Sessionkey u.fieldMap["unionid"] = u.Unionid u.fieldMap["server"] = u.Server u.fieldMap["summary"] = u.Summary u.fieldMap["ban"] = u.Ban u.fieldMap["gdtVid"] = u.GdtVid u.fieldMap["aId"] = u.AID u.fieldMap["flag"] = u.Flag u.fieldMap["adSrc"] = u.AdSrc } func (u userAccount) clone(db *gorm.DB) userAccount { u.userAccountDo.ReplaceConnPool(db.Statement.ConnPool) return u } func (u userAccount) replaceDB(db *gorm.DB) userAccount { u.userAccountDo.ReplaceDB(db) return u } type userAccountDo struct{ gen.DO } func (u userAccountDo) Debug() *userAccountDo { return u.withDO(u.DO.Debug()) } func (u userAccountDo) WithContext(ctx context.Context) *userAccountDo { return u.withDO(u.DO.WithContext(ctx)) } func (u userAccountDo) ReadDB() *userAccountDo { return u.Clauses(dbresolver.Read) } func (u userAccountDo) WriteDB() *userAccountDo { return u.Clauses(dbresolver.Write) } func (u userAccountDo) Session(config *gorm.Session) *userAccountDo { return u.withDO(u.DO.Session(config)) } func (u userAccountDo) Clauses(conds ...clause.Expression) *userAccountDo { return u.withDO(u.DO.Clauses(conds...)) } func (u userAccountDo) Returning(value interface{}, columns ...string) *userAccountDo { return u.withDO(u.DO.Returning(value, columns...)) } func (u userAccountDo) Not(conds ...gen.Condition) *userAccountDo { return u.withDO(u.DO.Not(conds...)) } func (u userAccountDo) Or(conds ...gen.Condition) *userAccountDo { return u.withDO(u.DO.Or(conds...)) } func (u userAccountDo) Select(conds ...field.Expr) *userAccountDo { return u.withDO(u.DO.Select(conds...)) } func (u userAccountDo) Where(conds ...gen.Condition) *userAccountDo { return u.withDO(u.DO.Where(conds...)) } func (u userAccountDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *userAccountDo { return u.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (u userAccountDo) Order(conds ...field.Expr) *userAccountDo { return u.withDO(u.DO.Order(conds...)) } func (u userAccountDo) Distinct(cols ...field.Expr) *userAccountDo { return u.withDO(u.DO.Distinct(cols...)) } func (u userAccountDo) Omit(cols ...field.Expr) *userAccountDo { return u.withDO(u.DO.Omit(cols...)) } func (u userAccountDo) Join(table schema.Tabler, on ...field.Expr) *userAccountDo { return u.withDO(u.DO.Join(table, on...)) } func (u userAccountDo) LeftJoin(table schema.Tabler, on ...field.Expr) *userAccountDo { return u.withDO(u.DO.LeftJoin(table, on...)) } func (u userAccountDo) RightJoin(table schema.Tabler, on ...field.Expr) *userAccountDo { return u.withDO(u.DO.RightJoin(table, on...)) } func (u userAccountDo) Group(cols ...field.Expr) *userAccountDo { return u.withDO(u.DO.Group(cols...)) } func (u userAccountDo) Having(conds ...gen.Condition) *userAccountDo { return u.withDO(u.DO.Having(conds...)) } func (u userAccountDo) Limit(limit int) *userAccountDo { return u.withDO(u.DO.Limit(limit)) } func (u userAccountDo) Offset(offset int) *userAccountDo { return u.withDO(u.DO.Offset(offset)) } func (u userAccountDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *userAccountDo { return u.withDO(u.DO.Scopes(funcs...)) } func (u userAccountDo) Unscoped() *userAccountDo { return u.withDO(u.DO.Unscoped()) } func (u userAccountDo) Create(values ...*model.UserAccount) error { if len(values) == 0 { return nil } return u.DO.Create(values) } func (u userAccountDo) CreateInBatches(values []*model.UserAccount, batchSize int) error { return u.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 (u userAccountDo) Save(values ...*model.UserAccount) error { if len(values) == 0 { return nil } return u.DO.Save(values) } func (u userAccountDo) First() (*model.UserAccount, error) { if result, err := u.DO.First(); err != nil { return nil, err } else { return result.(*model.UserAccount), nil } } func (u userAccountDo) Take() (*model.UserAccount, error) { if result, err := u.DO.Take(); err != nil { return nil, err } else { return result.(*model.UserAccount), nil } } func (u userAccountDo) Last() (*model.UserAccount, error) { if result, err := u.DO.Last(); err != nil { return nil, err } else { return result.(*model.UserAccount), nil } } func (u userAccountDo) Find() ([]*model.UserAccount, error) { result, err := u.DO.Find() return result.([]*model.UserAccount), err } func (u userAccountDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserAccount, err error) { buf := make([]*model.UserAccount, 0, batchSize) err = u.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 (u userAccountDo) FindInBatches(result *[]*model.UserAccount, batchSize int, fc func(tx gen.Dao, batch int) error) error { return u.DO.FindInBatches(result, batchSize, fc) } func (u userAccountDo) Attrs(attrs ...field.AssignExpr) *userAccountDo { return u.withDO(u.DO.Attrs(attrs...)) } func (u userAccountDo) Assign(attrs ...field.AssignExpr) *userAccountDo { return u.withDO(u.DO.Assign(attrs...)) } func (u userAccountDo) Joins(fields ...field.RelationField) *userAccountDo { for _, _f := range fields { u = *u.withDO(u.DO.Joins(_f)) } return &u } func (u userAccountDo) Preload(fields ...field.RelationField) *userAccountDo { for _, _f := range fields { u = *u.withDO(u.DO.Preload(_f)) } return &u } func (u userAccountDo) FirstOrInit() (*model.UserAccount, error) { if result, err := u.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.UserAccount), nil } } func (u userAccountDo) FirstOrCreate() (*model.UserAccount, error) { if result, err := u.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.UserAccount), nil } } func (u userAccountDo) FindByPage(offset int, limit int) (result []*model.UserAccount, count int64, err error) { result, err = u.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 = u.Offset(-1).Limit(-1).Count() return } func (u userAccountDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = u.Count() if err != nil { return } err = u.Offset(offset).Limit(limit).Scan(result) return } func (u userAccountDo) Scan(result interface{}) (err error) { return u.DO.Scan(result) } func (u userAccountDo) Delete(models ...*model.UserAccount) (result gen.ResultInfo, err error) { return u.DO.Delete(models) } func (u *userAccountDo) withDO(do gen.Dao) *userAccountDo { u.DO = *do.(*gen.DO) return u }