From 81124ec477b917845d23aafc54ef2ece2849ed1d Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 5 Jan 2026 13:01:30 +0100 Subject: [PATCH] Dump models --- models/agtagents.gen.go | 355 ++++++++++ models/agtagentsinspace.gen.go | 347 ++++++++++ models/agtagenttypes.gen.go | 335 ++++++++++ models/agtresearchagents.gen.go | 335 ++++++++++ models/certcerts.gen.go | 339 ++++++++++ models/certmasteries.gen.go | 337 ++++++++++ models/certskills.gen.go | 345 ++++++++++ models/chrancestries.gen.go | 369 +++++++++++ models/chrattributes.gen.go | 351 ++++++++++ models/chrbloodlines.gen.go | 395 +++++++++++ models/chrfactions.gen.go | 369 +++++++++++ models/chrraces.gen.go | 343 ++++++++++ models/crpactivities.gen.go | 337 ++++++++++ models/crpnpccorporationdivisions.gen.go | 341 ++++++++++ models/crpnpccorporationresearchfields.gen.go | 339 ++++++++++ models/crpnpccorporations.gen.go | 439 ++++++++++++ models/crpnpccorporationtrades.gen.go | 335 ++++++++++ models/crpnpcdivisions.gen.go | 343 ++++++++++ models/dgmattributecategories.gen.go | 339 ++++++++++ models/dgmattributetypes.gen.go | 371 +++++++++++ models/dgmeffects.gen.go | 437 ++++++++++++ models/dgmexpressions.gen.go | 367 ++++++++++ models/dgmtypeattributes.gen.go | 343 ++++++++++ models/dgmtypeeffects.gen.go | 339 ++++++++++ models/evegraphics.gen.go | 349 ++++++++++ models/eveicons.gen.go | 335 ++++++++++ models/eveunits.gen.go | 339 ++++++++++ models/gen.go | 627 ++++++++++++++++++ models/industryactivity.gen.go | 339 ++++++++++ models/industryactivitymaterials.gen.go | 343 ++++++++++ models/industryactivityprobabilities.gen.go | 345 ++++++++++ models/industryactivityproducts.gen.go | 343 ++++++++++ models/industryactivityraces.gen.go | 343 ++++++++++ models/industryactivityskills.gen.go | 343 ++++++++++ models/industryblueprints.gen.go | 335 ++++++++++ models/invcategories.gen.go | 341 ++++++++++ models/invcontrabandtypes.gen.go | 351 ++++++++++ models/invcontroltowerresourcepurposes.gen.go | 339 ++++++++++ models/invcontroltowerresources.gen.go | 351 ++++++++++ models/invflags.gen.go | 339 ++++++++++ models/invgroups.gen.go | 359 ++++++++++ models/invitems.gen.go | 347 ++++++++++ models/invmarketgroups.gen.go | 351 ++++++++++ models/invmetagroups.gen.go | 343 ++++++++++ models/invmetatypes.gen.go | 337 ++++++++++ models/invnames.gen.go | 331 +++++++++ models/invpositions.gen.go | 353 ++++++++++ models/invtraits.gen.go | 347 ++++++++++ models/invtypematerials.gen.go | 339 ++++++++++ models/invtypereactions.gen.go | 343 ++++++++++ models/invtypes.gen.go | 383 +++++++++++ models/invuniquenames.gen.go | 339 ++++++++++ models/invvolumes.gen.go | 333 ++++++++++ models/mapcelestialgraphics.gen.go | 347 ++++++++++ models/mapcelestialstatistics.gen.go | 407 ++++++++++++ models/mapconstellationjumps.gen.go | 343 ++++++++++ models/mapconstellations.gen.go | 383 +++++++++++ models/mapdenormalize.gen.go | 387 +++++++++++ models/mapjumps.gen.go | 331 +++++++++ models/maplandmarks.gen.go | 357 ++++++++++ models/maplocationscenes.gen.go | 335 ++++++++++ models/maplocationwormholeclasses.gen.go | 335 ++++++++++ models/mapregionjumps.gen.go | 335 ++++++++++ models/mapregions.gen.go | 381 +++++++++++ models/mapsolarsystemjumps.gen.go | 351 ++++++++++ models/mapsolarsystems.gen.go | 431 ++++++++++++ models/mapuniverse.gen.go | 373 +++++++++++ models/planetschematics.gen.go | 339 ++++++++++ models/planetschematicspinmap.gen.go | 335 ++++++++++ models/planetschematicstypemap.gen.go | 343 ++++++++++ models/ramactivities.gen.go | 345 ++++++++++ models/ramassemblylinestations.gen.go | 355 ++++++++++ ...amassemblylinetypedetailpercategory.gen.go | 351 ++++++++++ .../ramassemblylinetypedetailpergroup.gen.go | 351 ++++++++++ models/ramassemblylinetypes.gen.go | 363 ++++++++++ models/raminstallationtypecontents.gen.go | 341 ++++++++++ models/skinlicense.gen.go | 337 ++++++++++ models/skinmaterials.gen.go | 339 ++++++++++ models/skins.gen.go | 335 ++++++++++ models/skinship.gen.go | 331 +++++++++ models/staoperations.gen.go | 383 +++++++++++ models/staoperationservices.gen.go | 335 ++++++++++ models/staservices.gen.go | 337 ++++++++++ models/stastations.gen.go | 397 +++++++++++ models/stastationtypes.gen.go | 371 +++++++++++ models/translationtables.gen.go | 347 ++++++++++ models/trntranslationcolumns.gen.go | 347 ++++++++++ models/trntranslationlanguages.gen.go | 339 ++++++++++ models/trntranslations.gen.go | 343 ++++++++++ models/warcombatzones.gen.go | 347 ++++++++++ models/warcombatzonesystems.gen.go | 335 ++++++++++ 91 files changed, 32259 insertions(+) create mode 100644 models/agtagents.gen.go create mode 100644 models/agtagentsinspace.gen.go create mode 100644 models/agtagenttypes.gen.go create mode 100644 models/agtresearchagents.gen.go create mode 100644 models/certcerts.gen.go create mode 100644 models/certmasteries.gen.go create mode 100644 models/certskills.gen.go create mode 100644 models/chrancestries.gen.go create mode 100644 models/chrattributes.gen.go create mode 100644 models/chrbloodlines.gen.go create mode 100644 models/chrfactions.gen.go create mode 100644 models/chrraces.gen.go create mode 100644 models/crpactivities.gen.go create mode 100644 models/crpnpccorporationdivisions.gen.go create mode 100644 models/crpnpccorporationresearchfields.gen.go create mode 100644 models/crpnpccorporations.gen.go create mode 100644 models/crpnpccorporationtrades.gen.go create mode 100644 models/crpnpcdivisions.gen.go create mode 100644 models/dgmattributecategories.gen.go create mode 100644 models/dgmattributetypes.gen.go create mode 100644 models/dgmeffects.gen.go create mode 100644 models/dgmexpressions.gen.go create mode 100644 models/dgmtypeattributes.gen.go create mode 100644 models/dgmtypeeffects.gen.go create mode 100644 models/evegraphics.gen.go create mode 100644 models/eveicons.gen.go create mode 100644 models/eveunits.gen.go create mode 100644 models/gen.go create mode 100644 models/industryactivity.gen.go create mode 100644 models/industryactivitymaterials.gen.go create mode 100644 models/industryactivityprobabilities.gen.go create mode 100644 models/industryactivityproducts.gen.go create mode 100644 models/industryactivityraces.gen.go create mode 100644 models/industryactivityskills.gen.go create mode 100644 models/industryblueprints.gen.go create mode 100644 models/invcategories.gen.go create mode 100644 models/invcontrabandtypes.gen.go create mode 100644 models/invcontroltowerresourcepurposes.gen.go create mode 100644 models/invcontroltowerresources.gen.go create mode 100644 models/invflags.gen.go create mode 100644 models/invgroups.gen.go create mode 100644 models/invitems.gen.go create mode 100644 models/invmarketgroups.gen.go create mode 100644 models/invmetagroups.gen.go create mode 100644 models/invmetatypes.gen.go create mode 100644 models/invnames.gen.go create mode 100644 models/invpositions.gen.go create mode 100644 models/invtraits.gen.go create mode 100644 models/invtypematerials.gen.go create mode 100644 models/invtypereactions.gen.go create mode 100644 models/invtypes.gen.go create mode 100644 models/invuniquenames.gen.go create mode 100644 models/invvolumes.gen.go create mode 100644 models/mapcelestialgraphics.gen.go create mode 100644 models/mapcelestialstatistics.gen.go create mode 100644 models/mapconstellationjumps.gen.go create mode 100644 models/mapconstellations.gen.go create mode 100644 models/mapdenormalize.gen.go create mode 100644 models/mapjumps.gen.go create mode 100644 models/maplandmarks.gen.go create mode 100644 models/maplocationscenes.gen.go create mode 100644 models/maplocationwormholeclasses.gen.go create mode 100644 models/mapregionjumps.gen.go create mode 100644 models/mapregions.gen.go create mode 100644 models/mapsolarsystemjumps.gen.go create mode 100644 models/mapsolarsystems.gen.go create mode 100644 models/mapuniverse.gen.go create mode 100644 models/planetschematics.gen.go create mode 100644 models/planetschematicspinmap.gen.go create mode 100644 models/planetschematicstypemap.gen.go create mode 100644 models/ramactivities.gen.go create mode 100644 models/ramassemblylinestations.gen.go create mode 100644 models/ramassemblylinetypedetailpercategory.gen.go create mode 100644 models/ramassemblylinetypedetailpergroup.gen.go create mode 100644 models/ramassemblylinetypes.gen.go create mode 100644 models/raminstallationtypecontents.gen.go create mode 100644 models/skinlicense.gen.go create mode 100644 models/skinmaterials.gen.go create mode 100644 models/skins.gen.go create mode 100644 models/skinship.gen.go create mode 100644 models/staoperations.gen.go create mode 100644 models/staoperationservices.gen.go create mode 100644 models/staservices.gen.go create mode 100644 models/stastations.gen.go create mode 100644 models/stastationtypes.gen.go create mode 100644 models/translationtables.gen.go create mode 100644 models/trntranslationcolumns.gen.go create mode 100644 models/trntranslationlanguages.gen.go create mode 100644 models/trntranslations.gen.go create mode 100644 models/warcombatzones.gen.go create mode 100644 models/warcombatzonesystems.gen.go diff --git a/models/agtagents.gen.go b/models/agtagents.gen.go new file mode 100644 index 0000000..9eba217 --- /dev/null +++ b/models/agtagents.gen.go @@ -0,0 +1,355 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newAgtAgent(db *gorm.DB, opts ...gen.DOOption) agtAgent { + _agtAgent := agtAgent{} + + _agtAgent.agtAgentDo.UseDB(db, opts...) + _agtAgent.agtAgentDo.UseModel(&models.AgtAgent{}) + + tableName := _agtAgent.agtAgentDo.TableName() + _agtAgent.ALL = field.NewAsterisk(tableName) + _agtAgent.AgentID = field.NewInt32(tableName, "agentID") + _agtAgent.DivisionID = field.NewInt32(tableName, "divisionID") + _agtAgent.CorporationID = field.NewInt32(tableName, "corporationID") + _agtAgent.LocationID = field.NewInt32(tableName, "locationID") + _agtAgent.Level = field.NewInt32(tableName, "level") + _agtAgent.Quality = field.NewInt32(tableName, "quality") + _agtAgent.AgentTypeID = field.NewInt32(tableName, "agentTypeID") + _agtAgent.IsLocator = field.NewBool(tableName, "isLocator") + + _agtAgent.fillFieldMap() + + return _agtAgent +} + +type agtAgent struct { + agtAgentDo agtAgentDo + + ALL field.Asterisk + AgentID field.Int32 + DivisionID field.Int32 + CorporationID field.Int32 + LocationID field.Int32 + Level field.Int32 + Quality field.Int32 + AgentTypeID field.Int32 + IsLocator field.Bool + + fieldMap map[string]field.Expr +} + +func (a agtAgent) Table(newTableName string) *agtAgent { + a.agtAgentDo.UseTable(newTableName) + return a.updateTableName(newTableName) +} + +func (a agtAgent) As(alias string) *agtAgent { + a.agtAgentDo.DO = *(a.agtAgentDo.As(alias).(*gen.DO)) + return a.updateTableName(alias) +} + +func (a *agtAgent) updateTableName(table string) *agtAgent { + a.ALL = field.NewAsterisk(table) + a.AgentID = field.NewInt32(table, "agentID") + a.DivisionID = field.NewInt32(table, "divisionID") + a.CorporationID = field.NewInt32(table, "corporationID") + a.LocationID = field.NewInt32(table, "locationID") + a.Level = field.NewInt32(table, "level") + a.Quality = field.NewInt32(table, "quality") + a.AgentTypeID = field.NewInt32(table, "agentTypeID") + a.IsLocator = field.NewBool(table, "isLocator") + + a.fillFieldMap() + + return a +} + +func (a *agtAgent) WithContext(ctx context.Context) *agtAgentDo { return a.agtAgentDo.WithContext(ctx) } + +func (a agtAgent) TableName() string { return a.agtAgentDo.TableName() } + +func (a agtAgent) Alias() string { return a.agtAgentDo.Alias() } + +func (a agtAgent) Columns(cols ...field.Expr) gen.Columns { return a.agtAgentDo.Columns(cols...) } + +func (a *agtAgent) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := a.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (a *agtAgent) fillFieldMap() { + a.fieldMap = make(map[string]field.Expr, 8) + a.fieldMap["agentID"] = a.AgentID + a.fieldMap["divisionID"] = a.DivisionID + a.fieldMap["corporationID"] = a.CorporationID + a.fieldMap["locationID"] = a.LocationID + a.fieldMap["level"] = a.Level + a.fieldMap["quality"] = a.Quality + a.fieldMap["agentTypeID"] = a.AgentTypeID + a.fieldMap["isLocator"] = a.IsLocator +} + +func (a agtAgent) clone(db *gorm.DB) agtAgent { + a.agtAgentDo.ReplaceConnPool(db.Statement.ConnPool) + return a +} + +func (a agtAgent) replaceDB(db *gorm.DB) agtAgent { + a.agtAgentDo.ReplaceDB(db) + return a +} + +type agtAgentDo struct{ gen.DO } + +func (a agtAgentDo) Debug() *agtAgentDo { + return a.withDO(a.DO.Debug()) +} + +func (a agtAgentDo) WithContext(ctx context.Context) *agtAgentDo { + return a.withDO(a.DO.WithContext(ctx)) +} + +func (a agtAgentDo) ReadDB() *agtAgentDo { + return a.Clauses(dbresolver.Read) +} + +func (a agtAgentDo) WriteDB() *agtAgentDo { + return a.Clauses(dbresolver.Write) +} + +func (a agtAgentDo) Session(config *gorm.Session) *agtAgentDo { + return a.withDO(a.DO.Session(config)) +} + +func (a agtAgentDo) Clauses(conds ...clause.Expression) *agtAgentDo { + return a.withDO(a.DO.Clauses(conds...)) +} + +func (a agtAgentDo) Returning(value interface{}, columns ...string) *agtAgentDo { + return a.withDO(a.DO.Returning(value, columns...)) +} + +func (a agtAgentDo) Not(conds ...gen.Condition) *agtAgentDo { + return a.withDO(a.DO.Not(conds...)) +} + +func (a agtAgentDo) Or(conds ...gen.Condition) *agtAgentDo { + return a.withDO(a.DO.Or(conds...)) +} + +func (a agtAgentDo) Select(conds ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Select(conds...)) +} + +func (a agtAgentDo) Where(conds ...gen.Condition) *agtAgentDo { + return a.withDO(a.DO.Where(conds...)) +} + +func (a agtAgentDo) Order(conds ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Order(conds...)) +} + +func (a agtAgentDo) Distinct(cols ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Distinct(cols...)) +} + +func (a agtAgentDo) Omit(cols ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Omit(cols...)) +} + +func (a agtAgentDo) Join(table schema.Tabler, on ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Join(table, on...)) +} + +func (a agtAgentDo) LeftJoin(table schema.Tabler, on ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.LeftJoin(table, on...)) +} + +func (a agtAgentDo) RightJoin(table schema.Tabler, on ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.RightJoin(table, on...)) +} + +func (a agtAgentDo) Group(cols ...field.Expr) *agtAgentDo { + return a.withDO(a.DO.Group(cols...)) +} + +func (a agtAgentDo) Having(conds ...gen.Condition) *agtAgentDo { + return a.withDO(a.DO.Having(conds...)) +} + +func (a agtAgentDo) Limit(limit int) *agtAgentDo { + return a.withDO(a.DO.Limit(limit)) +} + +func (a agtAgentDo) Offset(offset int) *agtAgentDo { + return a.withDO(a.DO.Offset(offset)) +} + +func (a agtAgentDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *agtAgentDo { + return a.withDO(a.DO.Scopes(funcs...)) +} + +func (a agtAgentDo) Unscoped() *agtAgentDo { + return a.withDO(a.DO.Unscoped()) +} + +func (a agtAgentDo) Create(values ...*models.AgtAgent) error { + if len(values) == 0 { + return nil + } + return a.DO.Create(values) +} + +func (a agtAgentDo) CreateInBatches(values []*models.AgtAgent, batchSize int) error { + return a.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 (a agtAgentDo) Save(values ...*models.AgtAgent) error { + if len(values) == 0 { + return nil + } + return a.DO.Save(values) +} + +func (a agtAgentDo) First() (*models.AgtAgent, error) { + if result, err := a.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgent), nil + } +} + +func (a agtAgentDo) Take() (*models.AgtAgent, error) { + if result, err := a.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgent), nil + } +} + +func (a agtAgentDo) Last() (*models.AgtAgent, error) { + if result, err := a.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgent), nil + } +} + +func (a agtAgentDo) Find() ([]*models.AgtAgent, error) { + result, err := a.DO.Find() + return result.([]*models.AgtAgent), err +} + +func (a agtAgentDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AgtAgent, err error) { + buf := make([]*models.AgtAgent, 0, batchSize) + err = a.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 (a agtAgentDo) FindInBatches(result *[]*models.AgtAgent, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return a.DO.FindInBatches(result, batchSize, fc) +} + +func (a agtAgentDo) Attrs(attrs ...field.AssignExpr) *agtAgentDo { + return a.withDO(a.DO.Attrs(attrs...)) +} + +func (a agtAgentDo) Assign(attrs ...field.AssignExpr) *agtAgentDo { + return a.withDO(a.DO.Assign(attrs...)) +} + +func (a agtAgentDo) Joins(fields ...field.RelationField) *agtAgentDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Joins(_f)) + } + return &a +} + +func (a agtAgentDo) Preload(fields ...field.RelationField) *agtAgentDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Preload(_f)) + } + return &a +} + +func (a agtAgentDo) FirstOrInit() (*models.AgtAgent, error) { + if result, err := a.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgent), nil + } +} + +func (a agtAgentDo) FirstOrCreate() (*models.AgtAgent, error) { + if result, err := a.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgent), nil + } +} + +func (a agtAgentDo) FindByPage(offset int, limit int) (result []*models.AgtAgent, count int64, err error) { + result, err = a.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 = a.Offset(-1).Limit(-1).Count() + return +} + +func (a agtAgentDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = a.Count() + if err != nil { + return + } + + err = a.Offset(offset).Limit(limit).Scan(result) + return +} + +func (a agtAgentDo) Scan(result interface{}) (err error) { + return a.DO.Scan(result) +} + +func (a agtAgentDo) Delete(models ...*models.AgtAgent) (result gen.ResultInfo, err error) { + return a.DO.Delete(models) +} + +func (a *agtAgentDo) withDO(do gen.Dao) *agtAgentDo { + a.DO = *do.(*gen.DO) + return a +} diff --git a/models/agtagentsinspace.gen.go b/models/agtagentsinspace.gen.go new file mode 100644 index 0000000..0cf0dde --- /dev/null +++ b/models/agtagentsinspace.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newAgtAgentsInSpace(db *gorm.DB, opts ...gen.DOOption) agtAgentsInSpace { + _agtAgentsInSpace := agtAgentsInSpace{} + + _agtAgentsInSpace.agtAgentsInSpaceDo.UseDB(db, opts...) + _agtAgentsInSpace.agtAgentsInSpaceDo.UseModel(&models.AgtAgentsInSpace{}) + + tableName := _agtAgentsInSpace.agtAgentsInSpaceDo.TableName() + _agtAgentsInSpace.ALL = field.NewAsterisk(tableName) + _agtAgentsInSpace.AgentID = field.NewInt32(tableName, "agentID") + _agtAgentsInSpace.DungeonID = field.NewInt32(tableName, "dungeonID") + _agtAgentsInSpace.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _agtAgentsInSpace.SpawnPointID = field.NewInt32(tableName, "spawnPointID") + _agtAgentsInSpace.TypeID = field.NewInt32(tableName, "typeID") + + _agtAgentsInSpace.fillFieldMap() + + return _agtAgentsInSpace +} + +type agtAgentsInSpace struct { + agtAgentsInSpaceDo agtAgentsInSpaceDo + + ALL field.Asterisk + AgentID field.Int32 + DungeonID field.Int32 + SolarSystemID field.Int32 + SpawnPointID field.Int32 + TypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (a agtAgentsInSpace) Table(newTableName string) *agtAgentsInSpace { + a.agtAgentsInSpaceDo.UseTable(newTableName) + return a.updateTableName(newTableName) +} + +func (a agtAgentsInSpace) As(alias string) *agtAgentsInSpace { + a.agtAgentsInSpaceDo.DO = *(a.agtAgentsInSpaceDo.As(alias).(*gen.DO)) + return a.updateTableName(alias) +} + +func (a *agtAgentsInSpace) updateTableName(table string) *agtAgentsInSpace { + a.ALL = field.NewAsterisk(table) + a.AgentID = field.NewInt32(table, "agentID") + a.DungeonID = field.NewInt32(table, "dungeonID") + a.SolarSystemID = field.NewInt32(table, "solarSystemID") + a.SpawnPointID = field.NewInt32(table, "spawnPointID") + a.TypeID = field.NewInt32(table, "typeID") + + a.fillFieldMap() + + return a +} + +func (a *agtAgentsInSpace) WithContext(ctx context.Context) *agtAgentsInSpaceDo { + return a.agtAgentsInSpaceDo.WithContext(ctx) +} + +func (a agtAgentsInSpace) TableName() string { return a.agtAgentsInSpaceDo.TableName() } + +func (a agtAgentsInSpace) Alias() string { return a.agtAgentsInSpaceDo.Alias() } + +func (a agtAgentsInSpace) Columns(cols ...field.Expr) gen.Columns { + return a.agtAgentsInSpaceDo.Columns(cols...) +} + +func (a *agtAgentsInSpace) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := a.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (a *agtAgentsInSpace) fillFieldMap() { + a.fieldMap = make(map[string]field.Expr, 5) + a.fieldMap["agentID"] = a.AgentID + a.fieldMap["dungeonID"] = a.DungeonID + a.fieldMap["solarSystemID"] = a.SolarSystemID + a.fieldMap["spawnPointID"] = a.SpawnPointID + a.fieldMap["typeID"] = a.TypeID +} + +func (a agtAgentsInSpace) clone(db *gorm.DB) agtAgentsInSpace { + a.agtAgentsInSpaceDo.ReplaceConnPool(db.Statement.ConnPool) + return a +} + +func (a agtAgentsInSpace) replaceDB(db *gorm.DB) agtAgentsInSpace { + a.agtAgentsInSpaceDo.ReplaceDB(db) + return a +} + +type agtAgentsInSpaceDo struct{ gen.DO } + +func (a agtAgentsInSpaceDo) Debug() *agtAgentsInSpaceDo { + return a.withDO(a.DO.Debug()) +} + +func (a agtAgentsInSpaceDo) WithContext(ctx context.Context) *agtAgentsInSpaceDo { + return a.withDO(a.DO.WithContext(ctx)) +} + +func (a agtAgentsInSpaceDo) ReadDB() *agtAgentsInSpaceDo { + return a.Clauses(dbresolver.Read) +} + +func (a agtAgentsInSpaceDo) WriteDB() *agtAgentsInSpaceDo { + return a.Clauses(dbresolver.Write) +} + +func (a agtAgentsInSpaceDo) Session(config *gorm.Session) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Session(config)) +} + +func (a agtAgentsInSpaceDo) Clauses(conds ...clause.Expression) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Clauses(conds...)) +} + +func (a agtAgentsInSpaceDo) Returning(value interface{}, columns ...string) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Returning(value, columns...)) +} + +func (a agtAgentsInSpaceDo) Not(conds ...gen.Condition) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Not(conds...)) +} + +func (a agtAgentsInSpaceDo) Or(conds ...gen.Condition) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Or(conds...)) +} + +func (a agtAgentsInSpaceDo) Select(conds ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Select(conds...)) +} + +func (a agtAgentsInSpaceDo) Where(conds ...gen.Condition) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Where(conds...)) +} + +func (a agtAgentsInSpaceDo) Order(conds ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Order(conds...)) +} + +func (a agtAgentsInSpaceDo) Distinct(cols ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Distinct(cols...)) +} + +func (a agtAgentsInSpaceDo) Omit(cols ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Omit(cols...)) +} + +func (a agtAgentsInSpaceDo) Join(table schema.Tabler, on ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Join(table, on...)) +} + +func (a agtAgentsInSpaceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.LeftJoin(table, on...)) +} + +func (a agtAgentsInSpaceDo) RightJoin(table schema.Tabler, on ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.RightJoin(table, on...)) +} + +func (a agtAgentsInSpaceDo) Group(cols ...field.Expr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Group(cols...)) +} + +func (a agtAgentsInSpaceDo) Having(conds ...gen.Condition) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Having(conds...)) +} + +func (a agtAgentsInSpaceDo) Limit(limit int) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Limit(limit)) +} + +func (a agtAgentsInSpaceDo) Offset(offset int) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Offset(offset)) +} + +func (a agtAgentsInSpaceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Scopes(funcs...)) +} + +func (a agtAgentsInSpaceDo) Unscoped() *agtAgentsInSpaceDo { + return a.withDO(a.DO.Unscoped()) +} + +func (a agtAgentsInSpaceDo) Create(values ...*models.AgtAgentsInSpace) error { + if len(values) == 0 { + return nil + } + return a.DO.Create(values) +} + +func (a agtAgentsInSpaceDo) CreateInBatches(values []*models.AgtAgentsInSpace, batchSize int) error { + return a.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 (a agtAgentsInSpaceDo) Save(values ...*models.AgtAgentsInSpace) error { + if len(values) == 0 { + return nil + } + return a.DO.Save(values) +} + +func (a agtAgentsInSpaceDo) First() (*models.AgtAgentsInSpace, error) { + if result, err := a.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentsInSpace), nil + } +} + +func (a agtAgentsInSpaceDo) Take() (*models.AgtAgentsInSpace, error) { + if result, err := a.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentsInSpace), nil + } +} + +func (a agtAgentsInSpaceDo) Last() (*models.AgtAgentsInSpace, error) { + if result, err := a.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentsInSpace), nil + } +} + +func (a agtAgentsInSpaceDo) Find() ([]*models.AgtAgentsInSpace, error) { + result, err := a.DO.Find() + return result.([]*models.AgtAgentsInSpace), err +} + +func (a agtAgentsInSpaceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AgtAgentsInSpace, err error) { + buf := make([]*models.AgtAgentsInSpace, 0, batchSize) + err = a.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 (a agtAgentsInSpaceDo) FindInBatches(result *[]*models.AgtAgentsInSpace, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return a.DO.FindInBatches(result, batchSize, fc) +} + +func (a agtAgentsInSpaceDo) Attrs(attrs ...field.AssignExpr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Attrs(attrs...)) +} + +func (a agtAgentsInSpaceDo) Assign(attrs ...field.AssignExpr) *agtAgentsInSpaceDo { + return a.withDO(a.DO.Assign(attrs...)) +} + +func (a agtAgentsInSpaceDo) Joins(fields ...field.RelationField) *agtAgentsInSpaceDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Joins(_f)) + } + return &a +} + +func (a agtAgentsInSpaceDo) Preload(fields ...field.RelationField) *agtAgentsInSpaceDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Preload(_f)) + } + return &a +} + +func (a agtAgentsInSpaceDo) FirstOrInit() (*models.AgtAgentsInSpace, error) { + if result, err := a.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentsInSpace), nil + } +} + +func (a agtAgentsInSpaceDo) FirstOrCreate() (*models.AgtAgentsInSpace, error) { + if result, err := a.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentsInSpace), nil + } +} + +func (a agtAgentsInSpaceDo) FindByPage(offset int, limit int) (result []*models.AgtAgentsInSpace, count int64, err error) { + result, err = a.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 = a.Offset(-1).Limit(-1).Count() + return +} + +func (a agtAgentsInSpaceDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = a.Count() + if err != nil { + return + } + + err = a.Offset(offset).Limit(limit).Scan(result) + return +} + +func (a agtAgentsInSpaceDo) Scan(result interface{}) (err error) { + return a.DO.Scan(result) +} + +func (a agtAgentsInSpaceDo) Delete(models ...*models.AgtAgentsInSpace) (result gen.ResultInfo, err error) { + return a.DO.Delete(models) +} + +func (a *agtAgentsInSpaceDo) withDO(do gen.Dao) *agtAgentsInSpaceDo { + a.DO = *do.(*gen.DO) + return a +} diff --git a/models/agtagenttypes.gen.go b/models/agtagenttypes.gen.go new file mode 100644 index 0000000..dbe1ada --- /dev/null +++ b/models/agtagenttypes.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newAgtAgentType(db *gorm.DB, opts ...gen.DOOption) agtAgentType { + _agtAgentType := agtAgentType{} + + _agtAgentType.agtAgentTypeDo.UseDB(db, opts...) + _agtAgentType.agtAgentTypeDo.UseModel(&models.AgtAgentType{}) + + tableName := _agtAgentType.agtAgentTypeDo.TableName() + _agtAgentType.ALL = field.NewAsterisk(tableName) + _agtAgentType.AgentTypeID = field.NewInt32(tableName, "agentTypeID") + _agtAgentType.AgentType = field.NewString(tableName, "agentType") + + _agtAgentType.fillFieldMap() + + return _agtAgentType +} + +type agtAgentType struct { + agtAgentTypeDo agtAgentTypeDo + + ALL field.Asterisk + AgentTypeID field.Int32 + AgentType field.String + + fieldMap map[string]field.Expr +} + +func (a agtAgentType) Table(newTableName string) *agtAgentType { + a.agtAgentTypeDo.UseTable(newTableName) + return a.updateTableName(newTableName) +} + +func (a agtAgentType) As(alias string) *agtAgentType { + a.agtAgentTypeDo.DO = *(a.agtAgentTypeDo.As(alias).(*gen.DO)) + return a.updateTableName(alias) +} + +func (a *agtAgentType) updateTableName(table string) *agtAgentType { + a.ALL = field.NewAsterisk(table) + a.AgentTypeID = field.NewInt32(table, "agentTypeID") + a.AgentType = field.NewString(table, "agentType") + + a.fillFieldMap() + + return a +} + +func (a *agtAgentType) WithContext(ctx context.Context) *agtAgentTypeDo { + return a.agtAgentTypeDo.WithContext(ctx) +} + +func (a agtAgentType) TableName() string { return a.agtAgentTypeDo.TableName() } + +func (a agtAgentType) Alias() string { return a.agtAgentTypeDo.Alias() } + +func (a agtAgentType) Columns(cols ...field.Expr) gen.Columns { + return a.agtAgentTypeDo.Columns(cols...) +} + +func (a *agtAgentType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := a.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (a *agtAgentType) fillFieldMap() { + a.fieldMap = make(map[string]field.Expr, 2) + a.fieldMap["agentTypeID"] = a.AgentTypeID + a.fieldMap["agentType"] = a.AgentType +} + +func (a agtAgentType) clone(db *gorm.DB) agtAgentType { + a.agtAgentTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return a +} + +func (a agtAgentType) replaceDB(db *gorm.DB) agtAgentType { + a.agtAgentTypeDo.ReplaceDB(db) + return a +} + +type agtAgentTypeDo struct{ gen.DO } + +func (a agtAgentTypeDo) Debug() *agtAgentTypeDo { + return a.withDO(a.DO.Debug()) +} + +func (a agtAgentTypeDo) WithContext(ctx context.Context) *agtAgentTypeDo { + return a.withDO(a.DO.WithContext(ctx)) +} + +func (a agtAgentTypeDo) ReadDB() *agtAgentTypeDo { + return a.Clauses(dbresolver.Read) +} + +func (a agtAgentTypeDo) WriteDB() *agtAgentTypeDo { + return a.Clauses(dbresolver.Write) +} + +func (a agtAgentTypeDo) Session(config *gorm.Session) *agtAgentTypeDo { + return a.withDO(a.DO.Session(config)) +} + +func (a agtAgentTypeDo) Clauses(conds ...clause.Expression) *agtAgentTypeDo { + return a.withDO(a.DO.Clauses(conds...)) +} + +func (a agtAgentTypeDo) Returning(value interface{}, columns ...string) *agtAgentTypeDo { + return a.withDO(a.DO.Returning(value, columns...)) +} + +func (a agtAgentTypeDo) Not(conds ...gen.Condition) *agtAgentTypeDo { + return a.withDO(a.DO.Not(conds...)) +} + +func (a agtAgentTypeDo) Or(conds ...gen.Condition) *agtAgentTypeDo { + return a.withDO(a.DO.Or(conds...)) +} + +func (a agtAgentTypeDo) Select(conds ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Select(conds...)) +} + +func (a agtAgentTypeDo) Where(conds ...gen.Condition) *agtAgentTypeDo { + return a.withDO(a.DO.Where(conds...)) +} + +func (a agtAgentTypeDo) Order(conds ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Order(conds...)) +} + +func (a agtAgentTypeDo) Distinct(cols ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Distinct(cols...)) +} + +func (a agtAgentTypeDo) Omit(cols ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Omit(cols...)) +} + +func (a agtAgentTypeDo) Join(table schema.Tabler, on ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Join(table, on...)) +} + +func (a agtAgentTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.LeftJoin(table, on...)) +} + +func (a agtAgentTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.RightJoin(table, on...)) +} + +func (a agtAgentTypeDo) Group(cols ...field.Expr) *agtAgentTypeDo { + return a.withDO(a.DO.Group(cols...)) +} + +func (a agtAgentTypeDo) Having(conds ...gen.Condition) *agtAgentTypeDo { + return a.withDO(a.DO.Having(conds...)) +} + +func (a agtAgentTypeDo) Limit(limit int) *agtAgentTypeDo { + return a.withDO(a.DO.Limit(limit)) +} + +func (a agtAgentTypeDo) Offset(offset int) *agtAgentTypeDo { + return a.withDO(a.DO.Offset(offset)) +} + +func (a agtAgentTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *agtAgentTypeDo { + return a.withDO(a.DO.Scopes(funcs...)) +} + +func (a agtAgentTypeDo) Unscoped() *agtAgentTypeDo { + return a.withDO(a.DO.Unscoped()) +} + +func (a agtAgentTypeDo) Create(values ...*models.AgtAgentType) error { + if len(values) == 0 { + return nil + } + return a.DO.Create(values) +} + +func (a agtAgentTypeDo) CreateInBatches(values []*models.AgtAgentType, batchSize int) error { + return a.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 (a agtAgentTypeDo) Save(values ...*models.AgtAgentType) error { + if len(values) == 0 { + return nil + } + return a.DO.Save(values) +} + +func (a agtAgentTypeDo) First() (*models.AgtAgentType, error) { + if result, err := a.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentType), nil + } +} + +func (a agtAgentTypeDo) Take() (*models.AgtAgentType, error) { + if result, err := a.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentType), nil + } +} + +func (a agtAgentTypeDo) Last() (*models.AgtAgentType, error) { + if result, err := a.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentType), nil + } +} + +func (a agtAgentTypeDo) Find() ([]*models.AgtAgentType, error) { + result, err := a.DO.Find() + return result.([]*models.AgtAgentType), err +} + +func (a agtAgentTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AgtAgentType, err error) { + buf := make([]*models.AgtAgentType, 0, batchSize) + err = a.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 (a agtAgentTypeDo) FindInBatches(result *[]*models.AgtAgentType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return a.DO.FindInBatches(result, batchSize, fc) +} + +func (a agtAgentTypeDo) Attrs(attrs ...field.AssignExpr) *agtAgentTypeDo { + return a.withDO(a.DO.Attrs(attrs...)) +} + +func (a agtAgentTypeDo) Assign(attrs ...field.AssignExpr) *agtAgentTypeDo { + return a.withDO(a.DO.Assign(attrs...)) +} + +func (a agtAgentTypeDo) Joins(fields ...field.RelationField) *agtAgentTypeDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Joins(_f)) + } + return &a +} + +func (a agtAgentTypeDo) Preload(fields ...field.RelationField) *agtAgentTypeDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Preload(_f)) + } + return &a +} + +func (a agtAgentTypeDo) FirstOrInit() (*models.AgtAgentType, error) { + if result, err := a.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentType), nil + } +} + +func (a agtAgentTypeDo) FirstOrCreate() (*models.AgtAgentType, error) { + if result, err := a.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.AgtAgentType), nil + } +} + +func (a agtAgentTypeDo) FindByPage(offset int, limit int) (result []*models.AgtAgentType, count int64, err error) { + result, err = a.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 = a.Offset(-1).Limit(-1).Count() + return +} + +func (a agtAgentTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = a.Count() + if err != nil { + return + } + + err = a.Offset(offset).Limit(limit).Scan(result) + return +} + +func (a agtAgentTypeDo) Scan(result interface{}) (err error) { + return a.DO.Scan(result) +} + +func (a agtAgentTypeDo) Delete(models ...*models.AgtAgentType) (result gen.ResultInfo, err error) { + return a.DO.Delete(models) +} + +func (a *agtAgentTypeDo) withDO(do gen.Dao) *agtAgentTypeDo { + a.DO = *do.(*gen.DO) + return a +} diff --git a/models/agtresearchagents.gen.go b/models/agtresearchagents.gen.go new file mode 100644 index 0000000..4f03646 --- /dev/null +++ b/models/agtresearchagents.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newAgtResearchAgent(db *gorm.DB, opts ...gen.DOOption) agtResearchAgent { + _agtResearchAgent := agtResearchAgent{} + + _agtResearchAgent.agtResearchAgentDo.UseDB(db, opts...) + _agtResearchAgent.agtResearchAgentDo.UseModel(&models.AgtResearchAgent{}) + + tableName := _agtResearchAgent.agtResearchAgentDo.TableName() + _agtResearchAgent.ALL = field.NewAsterisk(tableName) + _agtResearchAgent.AgentID = field.NewInt32(tableName, "agentID") + _agtResearchAgent.TypeID = field.NewInt32(tableName, "typeID") + + _agtResearchAgent.fillFieldMap() + + return _agtResearchAgent +} + +type agtResearchAgent struct { + agtResearchAgentDo agtResearchAgentDo + + ALL field.Asterisk + AgentID field.Int32 + TypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (a agtResearchAgent) Table(newTableName string) *agtResearchAgent { + a.agtResearchAgentDo.UseTable(newTableName) + return a.updateTableName(newTableName) +} + +func (a agtResearchAgent) As(alias string) *agtResearchAgent { + a.agtResearchAgentDo.DO = *(a.agtResearchAgentDo.As(alias).(*gen.DO)) + return a.updateTableName(alias) +} + +func (a *agtResearchAgent) updateTableName(table string) *agtResearchAgent { + a.ALL = field.NewAsterisk(table) + a.AgentID = field.NewInt32(table, "agentID") + a.TypeID = field.NewInt32(table, "typeID") + + a.fillFieldMap() + + return a +} + +func (a *agtResearchAgent) WithContext(ctx context.Context) *agtResearchAgentDo { + return a.agtResearchAgentDo.WithContext(ctx) +} + +func (a agtResearchAgent) TableName() string { return a.agtResearchAgentDo.TableName() } + +func (a agtResearchAgent) Alias() string { return a.agtResearchAgentDo.Alias() } + +func (a agtResearchAgent) Columns(cols ...field.Expr) gen.Columns { + return a.agtResearchAgentDo.Columns(cols...) +} + +func (a *agtResearchAgent) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := a.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (a *agtResearchAgent) fillFieldMap() { + a.fieldMap = make(map[string]field.Expr, 2) + a.fieldMap["agentID"] = a.AgentID + a.fieldMap["typeID"] = a.TypeID +} + +func (a agtResearchAgent) clone(db *gorm.DB) agtResearchAgent { + a.agtResearchAgentDo.ReplaceConnPool(db.Statement.ConnPool) + return a +} + +func (a agtResearchAgent) replaceDB(db *gorm.DB) agtResearchAgent { + a.agtResearchAgentDo.ReplaceDB(db) + return a +} + +type agtResearchAgentDo struct{ gen.DO } + +func (a agtResearchAgentDo) Debug() *agtResearchAgentDo { + return a.withDO(a.DO.Debug()) +} + +func (a agtResearchAgentDo) WithContext(ctx context.Context) *agtResearchAgentDo { + return a.withDO(a.DO.WithContext(ctx)) +} + +func (a agtResearchAgentDo) ReadDB() *agtResearchAgentDo { + return a.Clauses(dbresolver.Read) +} + +func (a agtResearchAgentDo) WriteDB() *agtResearchAgentDo { + return a.Clauses(dbresolver.Write) +} + +func (a agtResearchAgentDo) Session(config *gorm.Session) *agtResearchAgentDo { + return a.withDO(a.DO.Session(config)) +} + +func (a agtResearchAgentDo) Clauses(conds ...clause.Expression) *agtResearchAgentDo { + return a.withDO(a.DO.Clauses(conds...)) +} + +func (a agtResearchAgentDo) Returning(value interface{}, columns ...string) *agtResearchAgentDo { + return a.withDO(a.DO.Returning(value, columns...)) +} + +func (a agtResearchAgentDo) Not(conds ...gen.Condition) *agtResearchAgentDo { + return a.withDO(a.DO.Not(conds...)) +} + +func (a agtResearchAgentDo) Or(conds ...gen.Condition) *agtResearchAgentDo { + return a.withDO(a.DO.Or(conds...)) +} + +func (a agtResearchAgentDo) Select(conds ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Select(conds...)) +} + +func (a agtResearchAgentDo) Where(conds ...gen.Condition) *agtResearchAgentDo { + return a.withDO(a.DO.Where(conds...)) +} + +func (a agtResearchAgentDo) Order(conds ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Order(conds...)) +} + +func (a agtResearchAgentDo) Distinct(cols ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Distinct(cols...)) +} + +func (a agtResearchAgentDo) Omit(cols ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Omit(cols...)) +} + +func (a agtResearchAgentDo) Join(table schema.Tabler, on ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Join(table, on...)) +} + +func (a agtResearchAgentDo) LeftJoin(table schema.Tabler, on ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.LeftJoin(table, on...)) +} + +func (a agtResearchAgentDo) RightJoin(table schema.Tabler, on ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.RightJoin(table, on...)) +} + +func (a agtResearchAgentDo) Group(cols ...field.Expr) *agtResearchAgentDo { + return a.withDO(a.DO.Group(cols...)) +} + +func (a agtResearchAgentDo) Having(conds ...gen.Condition) *agtResearchAgentDo { + return a.withDO(a.DO.Having(conds...)) +} + +func (a agtResearchAgentDo) Limit(limit int) *agtResearchAgentDo { + return a.withDO(a.DO.Limit(limit)) +} + +func (a agtResearchAgentDo) Offset(offset int) *agtResearchAgentDo { + return a.withDO(a.DO.Offset(offset)) +} + +func (a agtResearchAgentDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *agtResearchAgentDo { + return a.withDO(a.DO.Scopes(funcs...)) +} + +func (a agtResearchAgentDo) Unscoped() *agtResearchAgentDo { + return a.withDO(a.DO.Unscoped()) +} + +func (a agtResearchAgentDo) Create(values ...*models.AgtResearchAgent) error { + if len(values) == 0 { + return nil + } + return a.DO.Create(values) +} + +func (a agtResearchAgentDo) CreateInBatches(values []*models.AgtResearchAgent, batchSize int) error { + return a.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 (a agtResearchAgentDo) Save(values ...*models.AgtResearchAgent) error { + if len(values) == 0 { + return nil + } + return a.DO.Save(values) +} + +func (a agtResearchAgentDo) First() (*models.AgtResearchAgent, error) { + if result, err := a.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.AgtResearchAgent), nil + } +} + +func (a agtResearchAgentDo) Take() (*models.AgtResearchAgent, error) { + if result, err := a.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.AgtResearchAgent), nil + } +} + +func (a agtResearchAgentDo) Last() (*models.AgtResearchAgent, error) { + if result, err := a.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.AgtResearchAgent), nil + } +} + +func (a agtResearchAgentDo) Find() ([]*models.AgtResearchAgent, error) { + result, err := a.DO.Find() + return result.([]*models.AgtResearchAgent), err +} + +func (a agtResearchAgentDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AgtResearchAgent, err error) { + buf := make([]*models.AgtResearchAgent, 0, batchSize) + err = a.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 (a agtResearchAgentDo) FindInBatches(result *[]*models.AgtResearchAgent, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return a.DO.FindInBatches(result, batchSize, fc) +} + +func (a agtResearchAgentDo) Attrs(attrs ...field.AssignExpr) *agtResearchAgentDo { + return a.withDO(a.DO.Attrs(attrs...)) +} + +func (a agtResearchAgentDo) Assign(attrs ...field.AssignExpr) *agtResearchAgentDo { + return a.withDO(a.DO.Assign(attrs...)) +} + +func (a agtResearchAgentDo) Joins(fields ...field.RelationField) *agtResearchAgentDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Joins(_f)) + } + return &a +} + +func (a agtResearchAgentDo) Preload(fields ...field.RelationField) *agtResearchAgentDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Preload(_f)) + } + return &a +} + +func (a agtResearchAgentDo) FirstOrInit() (*models.AgtResearchAgent, error) { + if result, err := a.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.AgtResearchAgent), nil + } +} + +func (a agtResearchAgentDo) FirstOrCreate() (*models.AgtResearchAgent, error) { + if result, err := a.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.AgtResearchAgent), nil + } +} + +func (a agtResearchAgentDo) FindByPage(offset int, limit int) (result []*models.AgtResearchAgent, count int64, err error) { + result, err = a.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 = a.Offset(-1).Limit(-1).Count() + return +} + +func (a agtResearchAgentDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = a.Count() + if err != nil { + return + } + + err = a.Offset(offset).Limit(limit).Scan(result) + return +} + +func (a agtResearchAgentDo) Scan(result interface{}) (err error) { + return a.DO.Scan(result) +} + +func (a agtResearchAgentDo) Delete(models ...*models.AgtResearchAgent) (result gen.ResultInfo, err error) { + return a.DO.Delete(models) +} + +func (a *agtResearchAgentDo) withDO(do gen.Dao) *agtResearchAgentDo { + a.DO = *do.(*gen.DO) + return a +} diff --git a/models/certcerts.gen.go b/models/certcerts.gen.go new file mode 100644 index 0000000..71d38cd --- /dev/null +++ b/models/certcerts.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCertCert(db *gorm.DB, opts ...gen.DOOption) certCert { + _certCert := certCert{} + + _certCert.certCertDo.UseDB(db, opts...) + _certCert.certCertDo.UseModel(&models.CertCert{}) + + tableName := _certCert.certCertDo.TableName() + _certCert.ALL = field.NewAsterisk(tableName) + _certCert.CertID = field.NewInt32(tableName, "certID") + _certCert.Description = field.NewString(tableName, "description") + _certCert.GroupID = field.NewInt32(tableName, "groupID") + _certCert.Name = field.NewString(tableName, "name") + + _certCert.fillFieldMap() + + return _certCert +} + +type certCert struct { + certCertDo certCertDo + + ALL field.Asterisk + CertID field.Int32 + Description field.String + GroupID field.Int32 + Name field.String + + fieldMap map[string]field.Expr +} + +func (c certCert) Table(newTableName string) *certCert { + c.certCertDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c certCert) As(alias string) *certCert { + c.certCertDo.DO = *(c.certCertDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *certCert) updateTableName(table string) *certCert { + c.ALL = field.NewAsterisk(table) + c.CertID = field.NewInt32(table, "certID") + c.Description = field.NewString(table, "description") + c.GroupID = field.NewInt32(table, "groupID") + c.Name = field.NewString(table, "name") + + c.fillFieldMap() + + return c +} + +func (c *certCert) WithContext(ctx context.Context) *certCertDo { return c.certCertDo.WithContext(ctx) } + +func (c certCert) TableName() string { return c.certCertDo.TableName() } + +func (c certCert) Alias() string { return c.certCertDo.Alias() } + +func (c certCert) Columns(cols ...field.Expr) gen.Columns { return c.certCertDo.Columns(cols...) } + +func (c *certCert) 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 *certCert) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 4) + c.fieldMap["certID"] = c.CertID + c.fieldMap["description"] = c.Description + c.fieldMap["groupID"] = c.GroupID + c.fieldMap["name"] = c.Name +} + +func (c certCert) clone(db *gorm.DB) certCert { + c.certCertDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c certCert) replaceDB(db *gorm.DB) certCert { + c.certCertDo.ReplaceDB(db) + return c +} + +type certCertDo struct{ gen.DO } + +func (c certCertDo) Debug() *certCertDo { + return c.withDO(c.DO.Debug()) +} + +func (c certCertDo) WithContext(ctx context.Context) *certCertDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c certCertDo) ReadDB() *certCertDo { + return c.Clauses(dbresolver.Read) +} + +func (c certCertDo) WriteDB() *certCertDo { + return c.Clauses(dbresolver.Write) +} + +func (c certCertDo) Session(config *gorm.Session) *certCertDo { + return c.withDO(c.DO.Session(config)) +} + +func (c certCertDo) Clauses(conds ...clause.Expression) *certCertDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c certCertDo) Returning(value interface{}, columns ...string) *certCertDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c certCertDo) Not(conds ...gen.Condition) *certCertDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c certCertDo) Or(conds ...gen.Condition) *certCertDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c certCertDo) Select(conds ...field.Expr) *certCertDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c certCertDo) Where(conds ...gen.Condition) *certCertDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c certCertDo) Order(conds ...field.Expr) *certCertDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c certCertDo) Distinct(cols ...field.Expr) *certCertDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c certCertDo) Omit(cols ...field.Expr) *certCertDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c certCertDo) Join(table schema.Tabler, on ...field.Expr) *certCertDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c certCertDo) LeftJoin(table schema.Tabler, on ...field.Expr) *certCertDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c certCertDo) RightJoin(table schema.Tabler, on ...field.Expr) *certCertDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c certCertDo) Group(cols ...field.Expr) *certCertDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c certCertDo) Having(conds ...gen.Condition) *certCertDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c certCertDo) Limit(limit int) *certCertDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c certCertDo) Offset(offset int) *certCertDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c certCertDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *certCertDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c certCertDo) Unscoped() *certCertDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c certCertDo) Create(values ...*models.CertCert) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c certCertDo) CreateInBatches(values []*models.CertCert, 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 certCertDo) Save(values ...*models.CertCert) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c certCertDo) First() (*models.CertCert, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CertCert), nil + } +} + +func (c certCertDo) Take() (*models.CertCert, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CertCert), nil + } +} + +func (c certCertDo) Last() (*models.CertCert, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CertCert), nil + } +} + +func (c certCertDo) Find() ([]*models.CertCert, error) { + result, err := c.DO.Find() + return result.([]*models.CertCert), err +} + +func (c certCertDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CertCert, err error) { + buf := make([]*models.CertCert, 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 certCertDo) FindInBatches(result *[]*models.CertCert, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c certCertDo) Attrs(attrs ...field.AssignExpr) *certCertDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c certCertDo) Assign(attrs ...field.AssignExpr) *certCertDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c certCertDo) Joins(fields ...field.RelationField) *certCertDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c certCertDo) Preload(fields ...field.RelationField) *certCertDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c certCertDo) FirstOrInit() (*models.CertCert, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CertCert), nil + } +} + +func (c certCertDo) FirstOrCreate() (*models.CertCert, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CertCert), nil + } +} + +func (c certCertDo) FindByPage(offset int, limit int) (result []*models.CertCert, 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 certCertDo) 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 certCertDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c certCertDo) Delete(models ...*models.CertCert) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *certCertDo) withDO(do gen.Dao) *certCertDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/certmasteries.gen.go b/models/certmasteries.gen.go new file mode 100644 index 0000000..1d0e9c0 --- /dev/null +++ b/models/certmasteries.gen.go @@ -0,0 +1,337 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCertMastery(db *gorm.DB, opts ...gen.DOOption) certMastery { + _certMastery := certMastery{} + + _certMastery.certMasteryDo.UseDB(db, opts...) + _certMastery.certMasteryDo.UseModel(&models.CertMastery{}) + + tableName := _certMastery.certMasteryDo.TableName() + _certMastery.ALL = field.NewAsterisk(tableName) + _certMastery.TypeID = field.NewInt32(tableName, "typeID") + _certMastery.MasteryLevel = field.NewInt32(tableName, "masteryLevel") + _certMastery.CertID = field.NewInt32(tableName, "certID") + + _certMastery.fillFieldMap() + + return _certMastery +} + +type certMastery struct { + certMasteryDo certMasteryDo + + ALL field.Asterisk + TypeID field.Int32 + MasteryLevel field.Int32 + CertID field.Int32 + + fieldMap map[string]field.Expr +} + +func (c certMastery) Table(newTableName string) *certMastery { + c.certMasteryDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c certMastery) As(alias string) *certMastery { + c.certMasteryDo.DO = *(c.certMasteryDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *certMastery) updateTableName(table string) *certMastery { + c.ALL = field.NewAsterisk(table) + c.TypeID = field.NewInt32(table, "typeID") + c.MasteryLevel = field.NewInt32(table, "masteryLevel") + c.CertID = field.NewInt32(table, "certID") + + c.fillFieldMap() + + return c +} + +func (c *certMastery) WithContext(ctx context.Context) *certMasteryDo { + return c.certMasteryDo.WithContext(ctx) +} + +func (c certMastery) TableName() string { return c.certMasteryDo.TableName() } + +func (c certMastery) Alias() string { return c.certMasteryDo.Alias() } + +func (c certMastery) Columns(cols ...field.Expr) gen.Columns { return c.certMasteryDo.Columns(cols...) } + +func (c *certMastery) 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 *certMastery) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 3) + c.fieldMap["typeID"] = c.TypeID + c.fieldMap["masteryLevel"] = c.MasteryLevel + c.fieldMap["certID"] = c.CertID +} + +func (c certMastery) clone(db *gorm.DB) certMastery { + c.certMasteryDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c certMastery) replaceDB(db *gorm.DB) certMastery { + c.certMasteryDo.ReplaceDB(db) + return c +} + +type certMasteryDo struct{ gen.DO } + +func (c certMasteryDo) Debug() *certMasteryDo { + return c.withDO(c.DO.Debug()) +} + +func (c certMasteryDo) WithContext(ctx context.Context) *certMasteryDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c certMasteryDo) ReadDB() *certMasteryDo { + return c.Clauses(dbresolver.Read) +} + +func (c certMasteryDo) WriteDB() *certMasteryDo { + return c.Clauses(dbresolver.Write) +} + +func (c certMasteryDo) Session(config *gorm.Session) *certMasteryDo { + return c.withDO(c.DO.Session(config)) +} + +func (c certMasteryDo) Clauses(conds ...clause.Expression) *certMasteryDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c certMasteryDo) Returning(value interface{}, columns ...string) *certMasteryDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c certMasteryDo) Not(conds ...gen.Condition) *certMasteryDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c certMasteryDo) Or(conds ...gen.Condition) *certMasteryDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c certMasteryDo) Select(conds ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c certMasteryDo) Where(conds ...gen.Condition) *certMasteryDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c certMasteryDo) Order(conds ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c certMasteryDo) Distinct(cols ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c certMasteryDo) Omit(cols ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c certMasteryDo) Join(table schema.Tabler, on ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c certMasteryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c certMasteryDo) RightJoin(table schema.Tabler, on ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c certMasteryDo) Group(cols ...field.Expr) *certMasteryDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c certMasteryDo) Having(conds ...gen.Condition) *certMasteryDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c certMasteryDo) Limit(limit int) *certMasteryDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c certMasteryDo) Offset(offset int) *certMasteryDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c certMasteryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *certMasteryDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c certMasteryDo) Unscoped() *certMasteryDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c certMasteryDo) Create(values ...*models.CertMastery) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c certMasteryDo) CreateInBatches(values []*models.CertMastery, 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 certMasteryDo) Save(values ...*models.CertMastery) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c certMasteryDo) First() (*models.CertMastery, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CertMastery), nil + } +} + +func (c certMasteryDo) Take() (*models.CertMastery, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CertMastery), nil + } +} + +func (c certMasteryDo) Last() (*models.CertMastery, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CertMastery), nil + } +} + +func (c certMasteryDo) Find() ([]*models.CertMastery, error) { + result, err := c.DO.Find() + return result.([]*models.CertMastery), err +} + +func (c certMasteryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CertMastery, err error) { + buf := make([]*models.CertMastery, 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 certMasteryDo) FindInBatches(result *[]*models.CertMastery, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c certMasteryDo) Attrs(attrs ...field.AssignExpr) *certMasteryDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c certMasteryDo) Assign(attrs ...field.AssignExpr) *certMasteryDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c certMasteryDo) Joins(fields ...field.RelationField) *certMasteryDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c certMasteryDo) Preload(fields ...field.RelationField) *certMasteryDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c certMasteryDo) FirstOrInit() (*models.CertMastery, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CertMastery), nil + } +} + +func (c certMasteryDo) FirstOrCreate() (*models.CertMastery, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CertMastery), nil + } +} + +func (c certMasteryDo) FindByPage(offset int, limit int) (result []*models.CertMastery, 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 certMasteryDo) 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 certMasteryDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c certMasteryDo) Delete(models ...*models.CertMastery) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *certMasteryDo) withDO(do gen.Dao) *certMasteryDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/certskills.gen.go b/models/certskills.gen.go new file mode 100644 index 0000000..1501e2d --- /dev/null +++ b/models/certskills.gen.go @@ -0,0 +1,345 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCertSkill(db *gorm.DB, opts ...gen.DOOption) certSkill { + _certSkill := certSkill{} + + _certSkill.certSkillDo.UseDB(db, opts...) + _certSkill.certSkillDo.UseModel(&models.CertSkill{}) + + tableName := _certSkill.certSkillDo.TableName() + _certSkill.ALL = field.NewAsterisk(tableName) + _certSkill.CertID = field.NewInt32(tableName, "certID") + _certSkill.SkillID = field.NewInt32(tableName, "skillID") + _certSkill.CertLevelInt = field.NewInt32(tableName, "certLevelInt") + _certSkill.SkillLevel = field.NewInt32(tableName, "skillLevel") + _certSkill.CertLevelText = field.NewString(tableName, "certLevelText") + + _certSkill.fillFieldMap() + + return _certSkill +} + +type certSkill struct { + certSkillDo certSkillDo + + ALL field.Asterisk + CertID field.Int32 + SkillID field.Int32 + CertLevelInt field.Int32 + SkillLevel field.Int32 + CertLevelText field.String + + fieldMap map[string]field.Expr +} + +func (c certSkill) Table(newTableName string) *certSkill { + c.certSkillDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c certSkill) As(alias string) *certSkill { + c.certSkillDo.DO = *(c.certSkillDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *certSkill) updateTableName(table string) *certSkill { + c.ALL = field.NewAsterisk(table) + c.CertID = field.NewInt32(table, "certID") + c.SkillID = field.NewInt32(table, "skillID") + c.CertLevelInt = field.NewInt32(table, "certLevelInt") + c.SkillLevel = field.NewInt32(table, "skillLevel") + c.CertLevelText = field.NewString(table, "certLevelText") + + c.fillFieldMap() + + return c +} + +func (c *certSkill) WithContext(ctx context.Context) *certSkillDo { + return c.certSkillDo.WithContext(ctx) +} + +func (c certSkill) TableName() string { return c.certSkillDo.TableName() } + +func (c certSkill) Alias() string { return c.certSkillDo.Alias() } + +func (c certSkill) Columns(cols ...field.Expr) gen.Columns { return c.certSkillDo.Columns(cols...) } + +func (c *certSkill) 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 *certSkill) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 5) + c.fieldMap["certID"] = c.CertID + c.fieldMap["skillID"] = c.SkillID + c.fieldMap["certLevelInt"] = c.CertLevelInt + c.fieldMap["skillLevel"] = c.SkillLevel + c.fieldMap["certLevelText"] = c.CertLevelText +} + +func (c certSkill) clone(db *gorm.DB) certSkill { + c.certSkillDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c certSkill) replaceDB(db *gorm.DB) certSkill { + c.certSkillDo.ReplaceDB(db) + return c +} + +type certSkillDo struct{ gen.DO } + +func (c certSkillDo) Debug() *certSkillDo { + return c.withDO(c.DO.Debug()) +} + +func (c certSkillDo) WithContext(ctx context.Context) *certSkillDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c certSkillDo) ReadDB() *certSkillDo { + return c.Clauses(dbresolver.Read) +} + +func (c certSkillDo) WriteDB() *certSkillDo { + return c.Clauses(dbresolver.Write) +} + +func (c certSkillDo) Session(config *gorm.Session) *certSkillDo { + return c.withDO(c.DO.Session(config)) +} + +func (c certSkillDo) Clauses(conds ...clause.Expression) *certSkillDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c certSkillDo) Returning(value interface{}, columns ...string) *certSkillDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c certSkillDo) Not(conds ...gen.Condition) *certSkillDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c certSkillDo) Or(conds ...gen.Condition) *certSkillDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c certSkillDo) Select(conds ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c certSkillDo) Where(conds ...gen.Condition) *certSkillDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c certSkillDo) Order(conds ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c certSkillDo) Distinct(cols ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c certSkillDo) Omit(cols ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c certSkillDo) Join(table schema.Tabler, on ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c certSkillDo) LeftJoin(table schema.Tabler, on ...field.Expr) *certSkillDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c certSkillDo) RightJoin(table schema.Tabler, on ...field.Expr) *certSkillDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c certSkillDo) Group(cols ...field.Expr) *certSkillDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c certSkillDo) Having(conds ...gen.Condition) *certSkillDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c certSkillDo) Limit(limit int) *certSkillDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c certSkillDo) Offset(offset int) *certSkillDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c certSkillDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *certSkillDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c certSkillDo) Unscoped() *certSkillDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c certSkillDo) Create(values ...*models.CertSkill) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c certSkillDo) CreateInBatches(values []*models.CertSkill, 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 certSkillDo) Save(values ...*models.CertSkill) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c certSkillDo) First() (*models.CertSkill, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CertSkill), nil + } +} + +func (c certSkillDo) Take() (*models.CertSkill, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CertSkill), nil + } +} + +func (c certSkillDo) Last() (*models.CertSkill, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CertSkill), nil + } +} + +func (c certSkillDo) Find() ([]*models.CertSkill, error) { + result, err := c.DO.Find() + return result.([]*models.CertSkill), err +} + +func (c certSkillDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CertSkill, err error) { + buf := make([]*models.CertSkill, 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 certSkillDo) FindInBatches(result *[]*models.CertSkill, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c certSkillDo) Attrs(attrs ...field.AssignExpr) *certSkillDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c certSkillDo) Assign(attrs ...field.AssignExpr) *certSkillDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c certSkillDo) Joins(fields ...field.RelationField) *certSkillDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c certSkillDo) Preload(fields ...field.RelationField) *certSkillDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c certSkillDo) FirstOrInit() (*models.CertSkill, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CertSkill), nil + } +} + +func (c certSkillDo) FirstOrCreate() (*models.CertSkill, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CertSkill), nil + } +} + +func (c certSkillDo) FindByPage(offset int, limit int) (result []*models.CertSkill, 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 certSkillDo) 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 certSkillDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c certSkillDo) Delete(models ...*models.CertSkill) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *certSkillDo) withDO(do gen.Dao) *certSkillDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/chrancestries.gen.go b/models/chrancestries.gen.go new file mode 100644 index 0000000..1fda52b --- /dev/null +++ b/models/chrancestries.gen.go @@ -0,0 +1,369 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newChrAncestry(db *gorm.DB, opts ...gen.DOOption) chrAncestry { + _chrAncestry := chrAncestry{} + + _chrAncestry.chrAncestryDo.UseDB(db, opts...) + _chrAncestry.chrAncestryDo.UseModel(&models.ChrAncestry{}) + + tableName := _chrAncestry.chrAncestryDo.TableName() + _chrAncestry.ALL = field.NewAsterisk(tableName) + _chrAncestry.AncestryID = field.NewInt32(tableName, "ancestryID") + _chrAncestry.AncestryName = field.NewString(tableName, "ancestryName") + _chrAncestry.BloodlineID = field.NewInt32(tableName, "bloodlineID") + _chrAncestry.Description = field.NewString(tableName, "description") + _chrAncestry.Perception = field.NewInt32(tableName, "perception") + _chrAncestry.Willpower = field.NewInt32(tableName, "willpower") + _chrAncestry.Charisma = field.NewInt32(tableName, "charisma") + _chrAncestry.Memory = field.NewInt32(tableName, "memory") + _chrAncestry.Intelligence = field.NewInt32(tableName, "intelligence") + _chrAncestry.IconID = field.NewInt32(tableName, "iconID") + _chrAncestry.ShortDescription = field.NewString(tableName, "shortDescription") + + _chrAncestry.fillFieldMap() + + return _chrAncestry +} + +type chrAncestry struct { + chrAncestryDo chrAncestryDo + + ALL field.Asterisk + AncestryID field.Int32 + AncestryName field.String + BloodlineID field.Int32 + Description field.String + Perception field.Int32 + Willpower field.Int32 + Charisma field.Int32 + Memory field.Int32 + Intelligence field.Int32 + IconID field.Int32 + ShortDescription field.String + + fieldMap map[string]field.Expr +} + +func (c chrAncestry) Table(newTableName string) *chrAncestry { + c.chrAncestryDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c chrAncestry) As(alias string) *chrAncestry { + c.chrAncestryDo.DO = *(c.chrAncestryDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *chrAncestry) updateTableName(table string) *chrAncestry { + c.ALL = field.NewAsterisk(table) + c.AncestryID = field.NewInt32(table, "ancestryID") + c.AncestryName = field.NewString(table, "ancestryName") + c.BloodlineID = field.NewInt32(table, "bloodlineID") + c.Description = field.NewString(table, "description") + c.Perception = field.NewInt32(table, "perception") + c.Willpower = field.NewInt32(table, "willpower") + c.Charisma = field.NewInt32(table, "charisma") + c.Memory = field.NewInt32(table, "memory") + c.Intelligence = field.NewInt32(table, "intelligence") + c.IconID = field.NewInt32(table, "iconID") + c.ShortDescription = field.NewString(table, "shortDescription") + + c.fillFieldMap() + + return c +} + +func (c *chrAncestry) WithContext(ctx context.Context) *chrAncestryDo { + return c.chrAncestryDo.WithContext(ctx) +} + +func (c chrAncestry) TableName() string { return c.chrAncestryDo.TableName() } + +func (c chrAncestry) Alias() string { return c.chrAncestryDo.Alias() } + +func (c chrAncestry) Columns(cols ...field.Expr) gen.Columns { return c.chrAncestryDo.Columns(cols...) } + +func (c *chrAncestry) 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 *chrAncestry) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 11) + c.fieldMap["ancestryID"] = c.AncestryID + c.fieldMap["ancestryName"] = c.AncestryName + c.fieldMap["bloodlineID"] = c.BloodlineID + c.fieldMap["description"] = c.Description + c.fieldMap["perception"] = c.Perception + c.fieldMap["willpower"] = c.Willpower + c.fieldMap["charisma"] = c.Charisma + c.fieldMap["memory"] = c.Memory + c.fieldMap["intelligence"] = c.Intelligence + c.fieldMap["iconID"] = c.IconID + c.fieldMap["shortDescription"] = c.ShortDescription +} + +func (c chrAncestry) clone(db *gorm.DB) chrAncestry { + c.chrAncestryDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c chrAncestry) replaceDB(db *gorm.DB) chrAncestry { + c.chrAncestryDo.ReplaceDB(db) + return c +} + +type chrAncestryDo struct{ gen.DO } + +func (c chrAncestryDo) Debug() *chrAncestryDo { + return c.withDO(c.DO.Debug()) +} + +func (c chrAncestryDo) WithContext(ctx context.Context) *chrAncestryDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c chrAncestryDo) ReadDB() *chrAncestryDo { + return c.Clauses(dbresolver.Read) +} + +func (c chrAncestryDo) WriteDB() *chrAncestryDo { + return c.Clauses(dbresolver.Write) +} + +func (c chrAncestryDo) Session(config *gorm.Session) *chrAncestryDo { + return c.withDO(c.DO.Session(config)) +} + +func (c chrAncestryDo) Clauses(conds ...clause.Expression) *chrAncestryDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c chrAncestryDo) Returning(value interface{}, columns ...string) *chrAncestryDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c chrAncestryDo) Not(conds ...gen.Condition) *chrAncestryDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c chrAncestryDo) Or(conds ...gen.Condition) *chrAncestryDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c chrAncestryDo) Select(conds ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c chrAncestryDo) Where(conds ...gen.Condition) *chrAncestryDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c chrAncestryDo) Order(conds ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c chrAncestryDo) Distinct(cols ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c chrAncestryDo) Omit(cols ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c chrAncestryDo) Join(table schema.Tabler, on ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c chrAncestryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c chrAncestryDo) RightJoin(table schema.Tabler, on ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c chrAncestryDo) Group(cols ...field.Expr) *chrAncestryDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c chrAncestryDo) Having(conds ...gen.Condition) *chrAncestryDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c chrAncestryDo) Limit(limit int) *chrAncestryDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c chrAncestryDo) Offset(offset int) *chrAncestryDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c chrAncestryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chrAncestryDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c chrAncestryDo) Unscoped() *chrAncestryDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c chrAncestryDo) Create(values ...*models.ChrAncestry) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c chrAncestryDo) CreateInBatches(values []*models.ChrAncestry, 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 chrAncestryDo) Save(values ...*models.ChrAncestry) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c chrAncestryDo) First() (*models.ChrAncestry, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.ChrAncestry), nil + } +} + +func (c chrAncestryDo) Take() (*models.ChrAncestry, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.ChrAncestry), nil + } +} + +func (c chrAncestryDo) Last() (*models.ChrAncestry, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.ChrAncestry), nil + } +} + +func (c chrAncestryDo) Find() ([]*models.ChrAncestry, error) { + result, err := c.DO.Find() + return result.([]*models.ChrAncestry), err +} + +func (c chrAncestryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.ChrAncestry, err error) { + buf := make([]*models.ChrAncestry, 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 chrAncestryDo) FindInBatches(result *[]*models.ChrAncestry, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c chrAncestryDo) Attrs(attrs ...field.AssignExpr) *chrAncestryDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c chrAncestryDo) Assign(attrs ...field.AssignExpr) *chrAncestryDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c chrAncestryDo) Joins(fields ...field.RelationField) *chrAncestryDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c chrAncestryDo) Preload(fields ...field.RelationField) *chrAncestryDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c chrAncestryDo) FirstOrInit() (*models.ChrAncestry, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.ChrAncestry), nil + } +} + +func (c chrAncestryDo) FirstOrCreate() (*models.ChrAncestry, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.ChrAncestry), nil + } +} + +func (c chrAncestryDo) FindByPage(offset int, limit int) (result []*models.ChrAncestry, 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 chrAncestryDo) 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 chrAncestryDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c chrAncestryDo) Delete(models ...*models.ChrAncestry) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *chrAncestryDo) withDO(do gen.Dao) *chrAncestryDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/chrattributes.gen.go b/models/chrattributes.gen.go new file mode 100644 index 0000000..d0bc936 --- /dev/null +++ b/models/chrattributes.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newChrAttribute(db *gorm.DB, opts ...gen.DOOption) chrAttribute { + _chrAttribute := chrAttribute{} + + _chrAttribute.chrAttributeDo.UseDB(db, opts...) + _chrAttribute.chrAttributeDo.UseModel(&models.ChrAttribute{}) + + tableName := _chrAttribute.chrAttributeDo.TableName() + _chrAttribute.ALL = field.NewAsterisk(tableName) + _chrAttribute.AttributeID = field.NewInt32(tableName, "attributeID") + _chrAttribute.AttributeName = field.NewString(tableName, "attributeName") + _chrAttribute.Description = field.NewString(tableName, "description") + _chrAttribute.IconID = field.NewInt32(tableName, "iconID") + _chrAttribute.ShortDescription = field.NewString(tableName, "shortDescription") + _chrAttribute.Notes = field.NewString(tableName, "notes") + + _chrAttribute.fillFieldMap() + + return _chrAttribute +} + +type chrAttribute struct { + chrAttributeDo chrAttributeDo + + ALL field.Asterisk + AttributeID field.Int32 + AttributeName field.String + Description field.String + IconID field.Int32 + ShortDescription field.String + Notes field.String + + fieldMap map[string]field.Expr +} + +func (c chrAttribute) Table(newTableName string) *chrAttribute { + c.chrAttributeDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c chrAttribute) As(alias string) *chrAttribute { + c.chrAttributeDo.DO = *(c.chrAttributeDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *chrAttribute) updateTableName(table string) *chrAttribute { + c.ALL = field.NewAsterisk(table) + c.AttributeID = field.NewInt32(table, "attributeID") + c.AttributeName = field.NewString(table, "attributeName") + c.Description = field.NewString(table, "description") + c.IconID = field.NewInt32(table, "iconID") + c.ShortDescription = field.NewString(table, "shortDescription") + c.Notes = field.NewString(table, "notes") + + c.fillFieldMap() + + return c +} + +func (c *chrAttribute) WithContext(ctx context.Context) *chrAttributeDo { + return c.chrAttributeDo.WithContext(ctx) +} + +func (c chrAttribute) TableName() string { return c.chrAttributeDo.TableName() } + +func (c chrAttribute) Alias() string { return c.chrAttributeDo.Alias() } + +func (c chrAttribute) Columns(cols ...field.Expr) gen.Columns { + return c.chrAttributeDo.Columns(cols...) +} + +func (c *chrAttribute) 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 *chrAttribute) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 6) + c.fieldMap["attributeID"] = c.AttributeID + c.fieldMap["attributeName"] = c.AttributeName + c.fieldMap["description"] = c.Description + c.fieldMap["iconID"] = c.IconID + c.fieldMap["shortDescription"] = c.ShortDescription + c.fieldMap["notes"] = c.Notes +} + +func (c chrAttribute) clone(db *gorm.DB) chrAttribute { + c.chrAttributeDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c chrAttribute) replaceDB(db *gorm.DB) chrAttribute { + c.chrAttributeDo.ReplaceDB(db) + return c +} + +type chrAttributeDo struct{ gen.DO } + +func (c chrAttributeDo) Debug() *chrAttributeDo { + return c.withDO(c.DO.Debug()) +} + +func (c chrAttributeDo) WithContext(ctx context.Context) *chrAttributeDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c chrAttributeDo) ReadDB() *chrAttributeDo { + return c.Clauses(dbresolver.Read) +} + +func (c chrAttributeDo) WriteDB() *chrAttributeDo { + return c.Clauses(dbresolver.Write) +} + +func (c chrAttributeDo) Session(config *gorm.Session) *chrAttributeDo { + return c.withDO(c.DO.Session(config)) +} + +func (c chrAttributeDo) Clauses(conds ...clause.Expression) *chrAttributeDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c chrAttributeDo) Returning(value interface{}, columns ...string) *chrAttributeDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c chrAttributeDo) Not(conds ...gen.Condition) *chrAttributeDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c chrAttributeDo) Or(conds ...gen.Condition) *chrAttributeDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c chrAttributeDo) Select(conds ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c chrAttributeDo) Where(conds ...gen.Condition) *chrAttributeDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c chrAttributeDo) Order(conds ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c chrAttributeDo) Distinct(cols ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c chrAttributeDo) Omit(cols ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c chrAttributeDo) Join(table schema.Tabler, on ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c chrAttributeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c chrAttributeDo) RightJoin(table schema.Tabler, on ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c chrAttributeDo) Group(cols ...field.Expr) *chrAttributeDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c chrAttributeDo) Having(conds ...gen.Condition) *chrAttributeDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c chrAttributeDo) Limit(limit int) *chrAttributeDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c chrAttributeDo) Offset(offset int) *chrAttributeDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c chrAttributeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chrAttributeDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c chrAttributeDo) Unscoped() *chrAttributeDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c chrAttributeDo) Create(values ...*models.ChrAttribute) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c chrAttributeDo) CreateInBatches(values []*models.ChrAttribute, 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 chrAttributeDo) Save(values ...*models.ChrAttribute) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c chrAttributeDo) First() (*models.ChrAttribute, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.ChrAttribute), nil + } +} + +func (c chrAttributeDo) Take() (*models.ChrAttribute, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.ChrAttribute), nil + } +} + +func (c chrAttributeDo) Last() (*models.ChrAttribute, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.ChrAttribute), nil + } +} + +func (c chrAttributeDo) Find() ([]*models.ChrAttribute, error) { + result, err := c.DO.Find() + return result.([]*models.ChrAttribute), err +} + +func (c chrAttributeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.ChrAttribute, err error) { + buf := make([]*models.ChrAttribute, 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 chrAttributeDo) FindInBatches(result *[]*models.ChrAttribute, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c chrAttributeDo) Attrs(attrs ...field.AssignExpr) *chrAttributeDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c chrAttributeDo) Assign(attrs ...field.AssignExpr) *chrAttributeDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c chrAttributeDo) Joins(fields ...field.RelationField) *chrAttributeDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c chrAttributeDo) Preload(fields ...field.RelationField) *chrAttributeDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c chrAttributeDo) FirstOrInit() (*models.ChrAttribute, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.ChrAttribute), nil + } +} + +func (c chrAttributeDo) FirstOrCreate() (*models.ChrAttribute, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.ChrAttribute), nil + } +} + +func (c chrAttributeDo) FindByPage(offset int, limit int) (result []*models.ChrAttribute, 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 chrAttributeDo) 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 chrAttributeDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c chrAttributeDo) Delete(models ...*models.ChrAttribute) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *chrAttributeDo) withDO(do gen.Dao) *chrAttributeDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/chrbloodlines.gen.go b/models/chrbloodlines.gen.go new file mode 100644 index 0000000..e5dc4ea --- /dev/null +++ b/models/chrbloodlines.gen.go @@ -0,0 +1,395 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newChrBloodline(db *gorm.DB, opts ...gen.DOOption) chrBloodline { + _chrBloodline := chrBloodline{} + + _chrBloodline.chrBloodlineDo.UseDB(db, opts...) + _chrBloodline.chrBloodlineDo.UseModel(&models.ChrBloodline{}) + + tableName := _chrBloodline.chrBloodlineDo.TableName() + _chrBloodline.ALL = field.NewAsterisk(tableName) + _chrBloodline.BloodlineID = field.NewInt32(tableName, "bloodlineID") + _chrBloodline.BloodlineName = field.NewString(tableName, "bloodlineName") + _chrBloodline.RaceID = field.NewInt32(tableName, "raceID") + _chrBloodline.Description = field.NewString(tableName, "description") + _chrBloodline.MaleDescription = field.NewString(tableName, "maleDescription") + _chrBloodline.FemaleDescription = field.NewString(tableName, "femaleDescription") + _chrBloodline.ShipTypeID = field.NewInt32(tableName, "shipTypeID") + _chrBloodline.CorporationID = field.NewInt32(tableName, "corporationID") + _chrBloodline.Perception = field.NewInt32(tableName, "perception") + _chrBloodline.Willpower = field.NewInt32(tableName, "willpower") + _chrBloodline.Charisma = field.NewInt32(tableName, "charisma") + _chrBloodline.Memory = field.NewInt32(tableName, "memory") + _chrBloodline.Intelligence = field.NewInt32(tableName, "intelligence") + _chrBloodline.IconID = field.NewInt32(tableName, "iconID") + _chrBloodline.ShortDescription = field.NewString(tableName, "shortDescription") + _chrBloodline.ShortMaleDescription = field.NewString(tableName, "shortMaleDescription") + _chrBloodline.ShortFemaleDescription = field.NewString(tableName, "shortFemaleDescription") + + _chrBloodline.fillFieldMap() + + return _chrBloodline +} + +type chrBloodline struct { + chrBloodlineDo chrBloodlineDo + + ALL field.Asterisk + BloodlineID field.Int32 + BloodlineName field.String + RaceID field.Int32 + Description field.String + MaleDescription field.String + FemaleDescription field.String + ShipTypeID field.Int32 + CorporationID field.Int32 + Perception field.Int32 + Willpower field.Int32 + Charisma field.Int32 + Memory field.Int32 + Intelligence field.Int32 + IconID field.Int32 + ShortDescription field.String + ShortMaleDescription field.String + ShortFemaleDescription field.String + + fieldMap map[string]field.Expr +} + +func (c chrBloodline) Table(newTableName string) *chrBloodline { + c.chrBloodlineDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c chrBloodline) As(alias string) *chrBloodline { + c.chrBloodlineDo.DO = *(c.chrBloodlineDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *chrBloodline) updateTableName(table string) *chrBloodline { + c.ALL = field.NewAsterisk(table) + c.BloodlineID = field.NewInt32(table, "bloodlineID") + c.BloodlineName = field.NewString(table, "bloodlineName") + c.RaceID = field.NewInt32(table, "raceID") + c.Description = field.NewString(table, "description") + c.MaleDescription = field.NewString(table, "maleDescription") + c.FemaleDescription = field.NewString(table, "femaleDescription") + c.ShipTypeID = field.NewInt32(table, "shipTypeID") + c.CorporationID = field.NewInt32(table, "corporationID") + c.Perception = field.NewInt32(table, "perception") + c.Willpower = field.NewInt32(table, "willpower") + c.Charisma = field.NewInt32(table, "charisma") + c.Memory = field.NewInt32(table, "memory") + c.Intelligence = field.NewInt32(table, "intelligence") + c.IconID = field.NewInt32(table, "iconID") + c.ShortDescription = field.NewString(table, "shortDescription") + c.ShortMaleDescription = field.NewString(table, "shortMaleDescription") + c.ShortFemaleDescription = field.NewString(table, "shortFemaleDescription") + + c.fillFieldMap() + + return c +} + +func (c *chrBloodline) WithContext(ctx context.Context) *chrBloodlineDo { + return c.chrBloodlineDo.WithContext(ctx) +} + +func (c chrBloodline) TableName() string { return c.chrBloodlineDo.TableName() } + +func (c chrBloodline) Alias() string { return c.chrBloodlineDo.Alias() } + +func (c chrBloodline) Columns(cols ...field.Expr) gen.Columns { + return c.chrBloodlineDo.Columns(cols...) +} + +func (c *chrBloodline) 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 *chrBloodline) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 17) + c.fieldMap["bloodlineID"] = c.BloodlineID + c.fieldMap["bloodlineName"] = c.BloodlineName + c.fieldMap["raceID"] = c.RaceID + c.fieldMap["description"] = c.Description + c.fieldMap["maleDescription"] = c.MaleDescription + c.fieldMap["femaleDescription"] = c.FemaleDescription + c.fieldMap["shipTypeID"] = c.ShipTypeID + c.fieldMap["corporationID"] = c.CorporationID + c.fieldMap["perception"] = c.Perception + c.fieldMap["willpower"] = c.Willpower + c.fieldMap["charisma"] = c.Charisma + c.fieldMap["memory"] = c.Memory + c.fieldMap["intelligence"] = c.Intelligence + c.fieldMap["iconID"] = c.IconID + c.fieldMap["shortDescription"] = c.ShortDescription + c.fieldMap["shortMaleDescription"] = c.ShortMaleDescription + c.fieldMap["shortFemaleDescription"] = c.ShortFemaleDescription +} + +func (c chrBloodline) clone(db *gorm.DB) chrBloodline { + c.chrBloodlineDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c chrBloodline) replaceDB(db *gorm.DB) chrBloodline { + c.chrBloodlineDo.ReplaceDB(db) + return c +} + +type chrBloodlineDo struct{ gen.DO } + +func (c chrBloodlineDo) Debug() *chrBloodlineDo { + return c.withDO(c.DO.Debug()) +} + +func (c chrBloodlineDo) WithContext(ctx context.Context) *chrBloodlineDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c chrBloodlineDo) ReadDB() *chrBloodlineDo { + return c.Clauses(dbresolver.Read) +} + +func (c chrBloodlineDo) WriteDB() *chrBloodlineDo { + return c.Clauses(dbresolver.Write) +} + +func (c chrBloodlineDo) Session(config *gorm.Session) *chrBloodlineDo { + return c.withDO(c.DO.Session(config)) +} + +func (c chrBloodlineDo) Clauses(conds ...clause.Expression) *chrBloodlineDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c chrBloodlineDo) Returning(value interface{}, columns ...string) *chrBloodlineDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c chrBloodlineDo) Not(conds ...gen.Condition) *chrBloodlineDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c chrBloodlineDo) Or(conds ...gen.Condition) *chrBloodlineDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c chrBloodlineDo) Select(conds ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c chrBloodlineDo) Where(conds ...gen.Condition) *chrBloodlineDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c chrBloodlineDo) Order(conds ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c chrBloodlineDo) Distinct(cols ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c chrBloodlineDo) Omit(cols ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c chrBloodlineDo) Join(table schema.Tabler, on ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c chrBloodlineDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c chrBloodlineDo) RightJoin(table schema.Tabler, on ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c chrBloodlineDo) Group(cols ...field.Expr) *chrBloodlineDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c chrBloodlineDo) Having(conds ...gen.Condition) *chrBloodlineDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c chrBloodlineDo) Limit(limit int) *chrBloodlineDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c chrBloodlineDo) Offset(offset int) *chrBloodlineDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c chrBloodlineDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chrBloodlineDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c chrBloodlineDo) Unscoped() *chrBloodlineDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c chrBloodlineDo) Create(values ...*models.ChrBloodline) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c chrBloodlineDo) CreateInBatches(values []*models.ChrBloodline, 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 chrBloodlineDo) Save(values ...*models.ChrBloodline) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c chrBloodlineDo) First() (*models.ChrBloodline, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.ChrBloodline), nil + } +} + +func (c chrBloodlineDo) Take() (*models.ChrBloodline, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.ChrBloodline), nil + } +} + +func (c chrBloodlineDo) Last() (*models.ChrBloodline, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.ChrBloodline), nil + } +} + +func (c chrBloodlineDo) Find() ([]*models.ChrBloodline, error) { + result, err := c.DO.Find() + return result.([]*models.ChrBloodline), err +} + +func (c chrBloodlineDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.ChrBloodline, err error) { + buf := make([]*models.ChrBloodline, 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 chrBloodlineDo) FindInBatches(result *[]*models.ChrBloodline, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c chrBloodlineDo) Attrs(attrs ...field.AssignExpr) *chrBloodlineDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c chrBloodlineDo) Assign(attrs ...field.AssignExpr) *chrBloodlineDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c chrBloodlineDo) Joins(fields ...field.RelationField) *chrBloodlineDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c chrBloodlineDo) Preload(fields ...field.RelationField) *chrBloodlineDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c chrBloodlineDo) FirstOrInit() (*models.ChrBloodline, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.ChrBloodline), nil + } +} + +func (c chrBloodlineDo) FirstOrCreate() (*models.ChrBloodline, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.ChrBloodline), nil + } +} + +func (c chrBloodlineDo) FindByPage(offset int, limit int) (result []*models.ChrBloodline, 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 chrBloodlineDo) 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 chrBloodlineDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c chrBloodlineDo) Delete(models ...*models.ChrBloodline) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *chrBloodlineDo) withDO(do gen.Dao) *chrBloodlineDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/chrfactions.gen.go b/models/chrfactions.gen.go new file mode 100644 index 0000000..4583edc --- /dev/null +++ b/models/chrfactions.gen.go @@ -0,0 +1,369 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newChrFaction(db *gorm.DB, opts ...gen.DOOption) chrFaction { + _chrFaction := chrFaction{} + + _chrFaction.chrFactionDo.UseDB(db, opts...) + _chrFaction.chrFactionDo.UseModel(&models.ChrFaction{}) + + tableName := _chrFaction.chrFactionDo.TableName() + _chrFaction.ALL = field.NewAsterisk(tableName) + _chrFaction.FactionID = field.NewInt32(tableName, "factionID") + _chrFaction.FactionName = field.NewString(tableName, "factionName") + _chrFaction.Description = field.NewString(tableName, "description") + _chrFaction.RaceIDs = field.NewInt32(tableName, "raceIDs") + _chrFaction.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _chrFaction.CorporationID = field.NewInt32(tableName, "corporationID") + _chrFaction.SizeFactor = field.NewFloat64(tableName, "sizeFactor") + _chrFaction.StationCount = field.NewInt32(tableName, "stationCount") + _chrFaction.StationSystemCount = field.NewInt32(tableName, "stationSystemCount") + _chrFaction.MilitiaCorporationID = field.NewInt32(tableName, "militiaCorporationID") + _chrFaction.IconID = field.NewInt32(tableName, "iconID") + + _chrFaction.fillFieldMap() + + return _chrFaction +} + +type chrFaction struct { + chrFactionDo chrFactionDo + + ALL field.Asterisk + FactionID field.Int32 + FactionName field.String + Description field.String + RaceIDs field.Int32 + SolarSystemID field.Int32 + CorporationID field.Int32 + SizeFactor field.Float64 + StationCount field.Int32 + StationSystemCount field.Int32 + MilitiaCorporationID field.Int32 + IconID field.Int32 + + fieldMap map[string]field.Expr +} + +func (c chrFaction) Table(newTableName string) *chrFaction { + c.chrFactionDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c chrFaction) As(alias string) *chrFaction { + c.chrFactionDo.DO = *(c.chrFactionDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *chrFaction) updateTableName(table string) *chrFaction { + c.ALL = field.NewAsterisk(table) + c.FactionID = field.NewInt32(table, "factionID") + c.FactionName = field.NewString(table, "factionName") + c.Description = field.NewString(table, "description") + c.RaceIDs = field.NewInt32(table, "raceIDs") + c.SolarSystemID = field.NewInt32(table, "solarSystemID") + c.CorporationID = field.NewInt32(table, "corporationID") + c.SizeFactor = field.NewFloat64(table, "sizeFactor") + c.StationCount = field.NewInt32(table, "stationCount") + c.StationSystemCount = field.NewInt32(table, "stationSystemCount") + c.MilitiaCorporationID = field.NewInt32(table, "militiaCorporationID") + c.IconID = field.NewInt32(table, "iconID") + + c.fillFieldMap() + + return c +} + +func (c *chrFaction) WithContext(ctx context.Context) *chrFactionDo { + return c.chrFactionDo.WithContext(ctx) +} + +func (c chrFaction) TableName() string { return c.chrFactionDo.TableName() } + +func (c chrFaction) Alias() string { return c.chrFactionDo.Alias() } + +func (c chrFaction) Columns(cols ...field.Expr) gen.Columns { return c.chrFactionDo.Columns(cols...) } + +func (c *chrFaction) 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 *chrFaction) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 11) + c.fieldMap["factionID"] = c.FactionID + c.fieldMap["factionName"] = c.FactionName + c.fieldMap["description"] = c.Description + c.fieldMap["raceIDs"] = c.RaceIDs + c.fieldMap["solarSystemID"] = c.SolarSystemID + c.fieldMap["corporationID"] = c.CorporationID + c.fieldMap["sizeFactor"] = c.SizeFactor + c.fieldMap["stationCount"] = c.StationCount + c.fieldMap["stationSystemCount"] = c.StationSystemCount + c.fieldMap["militiaCorporationID"] = c.MilitiaCorporationID + c.fieldMap["iconID"] = c.IconID +} + +func (c chrFaction) clone(db *gorm.DB) chrFaction { + c.chrFactionDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c chrFaction) replaceDB(db *gorm.DB) chrFaction { + c.chrFactionDo.ReplaceDB(db) + return c +} + +type chrFactionDo struct{ gen.DO } + +func (c chrFactionDo) Debug() *chrFactionDo { + return c.withDO(c.DO.Debug()) +} + +func (c chrFactionDo) WithContext(ctx context.Context) *chrFactionDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c chrFactionDo) ReadDB() *chrFactionDo { + return c.Clauses(dbresolver.Read) +} + +func (c chrFactionDo) WriteDB() *chrFactionDo { + return c.Clauses(dbresolver.Write) +} + +func (c chrFactionDo) Session(config *gorm.Session) *chrFactionDo { + return c.withDO(c.DO.Session(config)) +} + +func (c chrFactionDo) Clauses(conds ...clause.Expression) *chrFactionDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c chrFactionDo) Returning(value interface{}, columns ...string) *chrFactionDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c chrFactionDo) Not(conds ...gen.Condition) *chrFactionDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c chrFactionDo) Or(conds ...gen.Condition) *chrFactionDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c chrFactionDo) Select(conds ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c chrFactionDo) Where(conds ...gen.Condition) *chrFactionDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c chrFactionDo) Order(conds ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c chrFactionDo) Distinct(cols ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c chrFactionDo) Omit(cols ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c chrFactionDo) Join(table schema.Tabler, on ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c chrFactionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c chrFactionDo) RightJoin(table schema.Tabler, on ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c chrFactionDo) Group(cols ...field.Expr) *chrFactionDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c chrFactionDo) Having(conds ...gen.Condition) *chrFactionDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c chrFactionDo) Limit(limit int) *chrFactionDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c chrFactionDo) Offset(offset int) *chrFactionDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c chrFactionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chrFactionDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c chrFactionDo) Unscoped() *chrFactionDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c chrFactionDo) Create(values ...*models.ChrFaction) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c chrFactionDo) CreateInBatches(values []*models.ChrFaction, 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 chrFactionDo) Save(values ...*models.ChrFaction) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c chrFactionDo) First() (*models.ChrFaction, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.ChrFaction), nil + } +} + +func (c chrFactionDo) Take() (*models.ChrFaction, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.ChrFaction), nil + } +} + +func (c chrFactionDo) Last() (*models.ChrFaction, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.ChrFaction), nil + } +} + +func (c chrFactionDo) Find() ([]*models.ChrFaction, error) { + result, err := c.DO.Find() + return result.([]*models.ChrFaction), err +} + +func (c chrFactionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.ChrFaction, err error) { + buf := make([]*models.ChrFaction, 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 chrFactionDo) FindInBatches(result *[]*models.ChrFaction, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c chrFactionDo) Attrs(attrs ...field.AssignExpr) *chrFactionDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c chrFactionDo) Assign(attrs ...field.AssignExpr) *chrFactionDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c chrFactionDo) Joins(fields ...field.RelationField) *chrFactionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c chrFactionDo) Preload(fields ...field.RelationField) *chrFactionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c chrFactionDo) FirstOrInit() (*models.ChrFaction, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.ChrFaction), nil + } +} + +func (c chrFactionDo) FirstOrCreate() (*models.ChrFaction, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.ChrFaction), nil + } +} + +func (c chrFactionDo) FindByPage(offset int, limit int) (result []*models.ChrFaction, 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 chrFactionDo) 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 chrFactionDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c chrFactionDo) Delete(models ...*models.ChrFaction) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *chrFactionDo) withDO(do gen.Dao) *chrFactionDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/chrraces.gen.go b/models/chrraces.gen.go new file mode 100644 index 0000000..34ba1de --- /dev/null +++ b/models/chrraces.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newChrRace(db *gorm.DB, opts ...gen.DOOption) chrRace { + _chrRace := chrRace{} + + _chrRace.chrRaceDo.UseDB(db, opts...) + _chrRace.chrRaceDo.UseModel(&models.ChrRace{}) + + tableName := _chrRace.chrRaceDo.TableName() + _chrRace.ALL = field.NewAsterisk(tableName) + _chrRace.RaceID = field.NewInt32(tableName, "raceID") + _chrRace.RaceName = field.NewString(tableName, "raceName") + _chrRace.Description = field.NewString(tableName, "description") + _chrRace.IconID = field.NewInt32(tableName, "iconID") + _chrRace.ShortDescription = field.NewString(tableName, "shortDescription") + + _chrRace.fillFieldMap() + + return _chrRace +} + +type chrRace struct { + chrRaceDo chrRaceDo + + ALL field.Asterisk + RaceID field.Int32 + RaceName field.String + Description field.String + IconID field.Int32 + ShortDescription field.String + + fieldMap map[string]field.Expr +} + +func (c chrRace) Table(newTableName string) *chrRace { + c.chrRaceDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c chrRace) As(alias string) *chrRace { + c.chrRaceDo.DO = *(c.chrRaceDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *chrRace) updateTableName(table string) *chrRace { + c.ALL = field.NewAsterisk(table) + c.RaceID = field.NewInt32(table, "raceID") + c.RaceName = field.NewString(table, "raceName") + c.Description = field.NewString(table, "description") + c.IconID = field.NewInt32(table, "iconID") + c.ShortDescription = field.NewString(table, "shortDescription") + + c.fillFieldMap() + + return c +} + +func (c *chrRace) WithContext(ctx context.Context) *chrRaceDo { return c.chrRaceDo.WithContext(ctx) } + +func (c chrRace) TableName() string { return c.chrRaceDo.TableName() } + +func (c chrRace) Alias() string { return c.chrRaceDo.Alias() } + +func (c chrRace) Columns(cols ...field.Expr) gen.Columns { return c.chrRaceDo.Columns(cols...) } + +func (c *chrRace) 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 *chrRace) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 5) + c.fieldMap["raceID"] = c.RaceID + c.fieldMap["raceName"] = c.RaceName + c.fieldMap["description"] = c.Description + c.fieldMap["iconID"] = c.IconID + c.fieldMap["shortDescription"] = c.ShortDescription +} + +func (c chrRace) clone(db *gorm.DB) chrRace { + c.chrRaceDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c chrRace) replaceDB(db *gorm.DB) chrRace { + c.chrRaceDo.ReplaceDB(db) + return c +} + +type chrRaceDo struct{ gen.DO } + +func (c chrRaceDo) Debug() *chrRaceDo { + return c.withDO(c.DO.Debug()) +} + +func (c chrRaceDo) WithContext(ctx context.Context) *chrRaceDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c chrRaceDo) ReadDB() *chrRaceDo { + return c.Clauses(dbresolver.Read) +} + +func (c chrRaceDo) WriteDB() *chrRaceDo { + return c.Clauses(dbresolver.Write) +} + +func (c chrRaceDo) Session(config *gorm.Session) *chrRaceDo { + return c.withDO(c.DO.Session(config)) +} + +func (c chrRaceDo) Clauses(conds ...clause.Expression) *chrRaceDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c chrRaceDo) Returning(value interface{}, columns ...string) *chrRaceDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c chrRaceDo) Not(conds ...gen.Condition) *chrRaceDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c chrRaceDo) Or(conds ...gen.Condition) *chrRaceDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c chrRaceDo) Select(conds ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c chrRaceDo) Where(conds ...gen.Condition) *chrRaceDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c chrRaceDo) Order(conds ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c chrRaceDo) Distinct(cols ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c chrRaceDo) Omit(cols ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c chrRaceDo) Join(table schema.Tabler, on ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c chrRaceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c chrRaceDo) RightJoin(table schema.Tabler, on ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c chrRaceDo) Group(cols ...field.Expr) *chrRaceDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c chrRaceDo) Having(conds ...gen.Condition) *chrRaceDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c chrRaceDo) Limit(limit int) *chrRaceDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c chrRaceDo) Offset(offset int) *chrRaceDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c chrRaceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chrRaceDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c chrRaceDo) Unscoped() *chrRaceDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c chrRaceDo) Create(values ...*models.ChrRace) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c chrRaceDo) CreateInBatches(values []*models.ChrRace, 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 chrRaceDo) Save(values ...*models.ChrRace) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c chrRaceDo) First() (*models.ChrRace, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.ChrRace), nil + } +} + +func (c chrRaceDo) Take() (*models.ChrRace, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.ChrRace), nil + } +} + +func (c chrRaceDo) Last() (*models.ChrRace, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.ChrRace), nil + } +} + +func (c chrRaceDo) Find() ([]*models.ChrRace, error) { + result, err := c.DO.Find() + return result.([]*models.ChrRace), err +} + +func (c chrRaceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.ChrRace, err error) { + buf := make([]*models.ChrRace, 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 chrRaceDo) FindInBatches(result *[]*models.ChrRace, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c chrRaceDo) Attrs(attrs ...field.AssignExpr) *chrRaceDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c chrRaceDo) Assign(attrs ...field.AssignExpr) *chrRaceDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c chrRaceDo) Joins(fields ...field.RelationField) *chrRaceDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c chrRaceDo) Preload(fields ...field.RelationField) *chrRaceDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c chrRaceDo) FirstOrInit() (*models.ChrRace, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.ChrRace), nil + } +} + +func (c chrRaceDo) FirstOrCreate() (*models.ChrRace, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.ChrRace), nil + } +} + +func (c chrRaceDo) FindByPage(offset int, limit int) (result []*models.ChrRace, 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 chrRaceDo) 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 chrRaceDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c chrRaceDo) Delete(models ...*models.ChrRace) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *chrRaceDo) withDO(do gen.Dao) *chrRaceDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpactivities.gen.go b/models/crpactivities.gen.go new file mode 100644 index 0000000..87696a8 --- /dev/null +++ b/models/crpactivities.gen.go @@ -0,0 +1,337 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpActivity(db *gorm.DB, opts ...gen.DOOption) crpActivity { + _crpActivity := crpActivity{} + + _crpActivity.crpActivityDo.UseDB(db, opts...) + _crpActivity.crpActivityDo.UseModel(&models.CrpActivity{}) + + tableName := _crpActivity.crpActivityDo.TableName() + _crpActivity.ALL = field.NewAsterisk(tableName) + _crpActivity.ActivityID = field.NewInt32(tableName, "activityID") + _crpActivity.ActivityName = field.NewString(tableName, "activityName") + _crpActivity.Description = field.NewString(tableName, "description") + + _crpActivity.fillFieldMap() + + return _crpActivity +} + +type crpActivity struct { + crpActivityDo crpActivityDo + + ALL field.Asterisk + ActivityID field.Int32 + ActivityName field.String + Description field.String + + fieldMap map[string]field.Expr +} + +func (c crpActivity) Table(newTableName string) *crpActivity { + c.crpActivityDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpActivity) As(alias string) *crpActivity { + c.crpActivityDo.DO = *(c.crpActivityDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpActivity) updateTableName(table string) *crpActivity { + c.ALL = field.NewAsterisk(table) + c.ActivityID = field.NewInt32(table, "activityID") + c.ActivityName = field.NewString(table, "activityName") + c.Description = field.NewString(table, "description") + + c.fillFieldMap() + + return c +} + +func (c *crpActivity) WithContext(ctx context.Context) *crpActivityDo { + return c.crpActivityDo.WithContext(ctx) +} + +func (c crpActivity) TableName() string { return c.crpActivityDo.TableName() } + +func (c crpActivity) Alias() string { return c.crpActivityDo.Alias() } + +func (c crpActivity) Columns(cols ...field.Expr) gen.Columns { return c.crpActivityDo.Columns(cols...) } + +func (c *crpActivity) 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 *crpActivity) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 3) + c.fieldMap["activityID"] = c.ActivityID + c.fieldMap["activityName"] = c.ActivityName + c.fieldMap["description"] = c.Description +} + +func (c crpActivity) clone(db *gorm.DB) crpActivity { + c.crpActivityDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpActivity) replaceDB(db *gorm.DB) crpActivity { + c.crpActivityDo.ReplaceDB(db) + return c +} + +type crpActivityDo struct{ gen.DO } + +func (c crpActivityDo) Debug() *crpActivityDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpActivityDo) WithContext(ctx context.Context) *crpActivityDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpActivityDo) ReadDB() *crpActivityDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpActivityDo) WriteDB() *crpActivityDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpActivityDo) Session(config *gorm.Session) *crpActivityDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpActivityDo) Clauses(conds ...clause.Expression) *crpActivityDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpActivityDo) Returning(value interface{}, columns ...string) *crpActivityDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpActivityDo) Not(conds ...gen.Condition) *crpActivityDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpActivityDo) Or(conds ...gen.Condition) *crpActivityDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpActivityDo) Select(conds ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpActivityDo) Where(conds ...gen.Condition) *crpActivityDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpActivityDo) Order(conds ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpActivityDo) Distinct(cols ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpActivityDo) Omit(cols ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpActivityDo) Join(table schema.Tabler, on ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpActivityDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpActivityDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpActivityDo) Group(cols ...field.Expr) *crpActivityDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpActivityDo) Having(conds ...gen.Condition) *crpActivityDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpActivityDo) Limit(limit int) *crpActivityDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpActivityDo) Offset(offset int) *crpActivityDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpActivityDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpActivityDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpActivityDo) Unscoped() *crpActivityDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpActivityDo) Create(values ...*models.CrpActivity) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpActivityDo) CreateInBatches(values []*models.CrpActivity, 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 crpActivityDo) Save(values ...*models.CrpActivity) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpActivityDo) First() (*models.CrpActivity, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpActivity), nil + } +} + +func (c crpActivityDo) Take() (*models.CrpActivity, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpActivity), nil + } +} + +func (c crpActivityDo) Last() (*models.CrpActivity, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpActivity), nil + } +} + +func (c crpActivityDo) Find() ([]*models.CrpActivity, error) { + result, err := c.DO.Find() + return result.([]*models.CrpActivity), err +} + +func (c crpActivityDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpActivity, err error) { + buf := make([]*models.CrpActivity, 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 crpActivityDo) FindInBatches(result *[]*models.CrpActivity, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpActivityDo) Attrs(attrs ...field.AssignExpr) *crpActivityDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpActivityDo) Assign(attrs ...field.AssignExpr) *crpActivityDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpActivityDo) Joins(fields ...field.RelationField) *crpActivityDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpActivityDo) Preload(fields ...field.RelationField) *crpActivityDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpActivityDo) FirstOrInit() (*models.CrpActivity, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpActivity), nil + } +} + +func (c crpActivityDo) FirstOrCreate() (*models.CrpActivity, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpActivity), nil + } +} + +func (c crpActivityDo) FindByPage(offset int, limit int) (result []*models.CrpActivity, 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 crpActivityDo) 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 crpActivityDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpActivityDo) Delete(models ...*models.CrpActivity) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpActivityDo) withDO(do gen.Dao) *crpActivityDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpnpccorporationdivisions.gen.go b/models/crpnpccorporationdivisions.gen.go new file mode 100644 index 0000000..92a8a43 --- /dev/null +++ b/models/crpnpccorporationdivisions.gen.go @@ -0,0 +1,341 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpNPCCorporationDivision(db *gorm.DB, opts ...gen.DOOption) crpNPCCorporationDivision { + _crpNPCCorporationDivision := crpNPCCorporationDivision{} + + _crpNPCCorporationDivision.crpNPCCorporationDivisionDo.UseDB(db, opts...) + _crpNPCCorporationDivision.crpNPCCorporationDivisionDo.UseModel(&models.CrpNPCCorporationDivision{}) + + tableName := _crpNPCCorporationDivision.crpNPCCorporationDivisionDo.TableName() + _crpNPCCorporationDivision.ALL = field.NewAsterisk(tableName) + _crpNPCCorporationDivision.CorporationID = field.NewInt32(tableName, "corporationID") + _crpNPCCorporationDivision.DivisionID = field.NewInt32(tableName, "divisionID") + _crpNPCCorporationDivision.Size = field.NewInt32(tableName, "size") + + _crpNPCCorporationDivision.fillFieldMap() + + return _crpNPCCorporationDivision +} + +type crpNPCCorporationDivision struct { + crpNPCCorporationDivisionDo crpNPCCorporationDivisionDo + + ALL field.Asterisk + CorporationID field.Int32 + DivisionID field.Int32 + Size field.Int32 + + fieldMap map[string]field.Expr +} + +func (c crpNPCCorporationDivision) Table(newTableName string) *crpNPCCorporationDivision { + c.crpNPCCorporationDivisionDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpNPCCorporationDivision) As(alias string) *crpNPCCorporationDivision { + c.crpNPCCorporationDivisionDo.DO = *(c.crpNPCCorporationDivisionDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpNPCCorporationDivision) updateTableName(table string) *crpNPCCorporationDivision { + c.ALL = field.NewAsterisk(table) + c.CorporationID = field.NewInt32(table, "corporationID") + c.DivisionID = field.NewInt32(table, "divisionID") + c.Size = field.NewInt32(table, "size") + + c.fillFieldMap() + + return c +} + +func (c *crpNPCCorporationDivision) WithContext(ctx context.Context) *crpNPCCorporationDivisionDo { + return c.crpNPCCorporationDivisionDo.WithContext(ctx) +} + +func (c crpNPCCorporationDivision) TableName() string { + return c.crpNPCCorporationDivisionDo.TableName() +} + +func (c crpNPCCorporationDivision) Alias() string { return c.crpNPCCorporationDivisionDo.Alias() } + +func (c crpNPCCorporationDivision) Columns(cols ...field.Expr) gen.Columns { + return c.crpNPCCorporationDivisionDo.Columns(cols...) +} + +func (c *crpNPCCorporationDivision) 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 *crpNPCCorporationDivision) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 3) + c.fieldMap["corporationID"] = c.CorporationID + c.fieldMap["divisionID"] = c.DivisionID + c.fieldMap["size"] = c.Size +} + +func (c crpNPCCorporationDivision) clone(db *gorm.DB) crpNPCCorporationDivision { + c.crpNPCCorporationDivisionDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpNPCCorporationDivision) replaceDB(db *gorm.DB) crpNPCCorporationDivision { + c.crpNPCCorporationDivisionDo.ReplaceDB(db) + return c +} + +type crpNPCCorporationDivisionDo struct{ gen.DO } + +func (c crpNPCCorporationDivisionDo) Debug() *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpNPCCorporationDivisionDo) WithContext(ctx context.Context) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpNPCCorporationDivisionDo) ReadDB() *crpNPCCorporationDivisionDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpNPCCorporationDivisionDo) WriteDB() *crpNPCCorporationDivisionDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpNPCCorporationDivisionDo) Session(config *gorm.Session) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpNPCCorporationDivisionDo) Clauses(conds ...clause.Expression) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Returning(value interface{}, columns ...string) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpNPCCorporationDivisionDo) Not(conds ...gen.Condition) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Or(conds ...gen.Condition) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Select(conds ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Where(conds ...gen.Condition) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Order(conds ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Distinct(cols ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpNPCCorporationDivisionDo) Omit(cols ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpNPCCorporationDivisionDo) Join(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpNPCCorporationDivisionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpNPCCorporationDivisionDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpNPCCorporationDivisionDo) Group(cols ...field.Expr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpNPCCorporationDivisionDo) Having(conds ...gen.Condition) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpNPCCorporationDivisionDo) Limit(limit int) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpNPCCorporationDivisionDo) Offset(offset int) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpNPCCorporationDivisionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpNPCCorporationDivisionDo) Unscoped() *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpNPCCorporationDivisionDo) Create(values ...*models.CrpNPCCorporationDivision) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpNPCCorporationDivisionDo) CreateInBatches(values []*models.CrpNPCCorporationDivision, 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 crpNPCCorporationDivisionDo) Save(values ...*models.CrpNPCCorporationDivision) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpNPCCorporationDivisionDo) First() (*models.CrpNPCCorporationDivision, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationDivision), nil + } +} + +func (c crpNPCCorporationDivisionDo) Take() (*models.CrpNPCCorporationDivision, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationDivision), nil + } +} + +func (c crpNPCCorporationDivisionDo) Last() (*models.CrpNPCCorporationDivision, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationDivision), nil + } +} + +func (c crpNPCCorporationDivisionDo) Find() ([]*models.CrpNPCCorporationDivision, error) { + result, err := c.DO.Find() + return result.([]*models.CrpNPCCorporationDivision), err +} + +func (c crpNPCCorporationDivisionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpNPCCorporationDivision, err error) { + buf := make([]*models.CrpNPCCorporationDivision, 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 crpNPCCorporationDivisionDo) FindInBatches(result *[]*models.CrpNPCCorporationDivision, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpNPCCorporationDivisionDo) Attrs(attrs ...field.AssignExpr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpNPCCorporationDivisionDo) Assign(attrs ...field.AssignExpr) *crpNPCCorporationDivisionDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpNPCCorporationDivisionDo) Joins(fields ...field.RelationField) *crpNPCCorporationDivisionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpNPCCorporationDivisionDo) Preload(fields ...field.RelationField) *crpNPCCorporationDivisionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpNPCCorporationDivisionDo) FirstOrInit() (*models.CrpNPCCorporationDivision, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationDivision), nil + } +} + +func (c crpNPCCorporationDivisionDo) FirstOrCreate() (*models.CrpNPCCorporationDivision, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationDivision), nil + } +} + +func (c crpNPCCorporationDivisionDo) FindByPage(offset int, limit int) (result []*models.CrpNPCCorporationDivision, 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 crpNPCCorporationDivisionDo) 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 crpNPCCorporationDivisionDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpNPCCorporationDivisionDo) Delete(models ...*models.CrpNPCCorporationDivision) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpNPCCorporationDivisionDo) withDO(do gen.Dao) *crpNPCCorporationDivisionDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpnpccorporationresearchfields.gen.go b/models/crpnpccorporationresearchfields.gen.go new file mode 100644 index 0000000..93adcc6 --- /dev/null +++ b/models/crpnpccorporationresearchfields.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpNPCCorporationResearchField(db *gorm.DB, opts ...gen.DOOption) crpNPCCorporationResearchField { + _crpNPCCorporationResearchField := crpNPCCorporationResearchField{} + + _crpNPCCorporationResearchField.crpNPCCorporationResearchFieldDo.UseDB(db, opts...) + _crpNPCCorporationResearchField.crpNPCCorporationResearchFieldDo.UseModel(&models.CrpNPCCorporationResearchField{}) + + tableName := _crpNPCCorporationResearchField.crpNPCCorporationResearchFieldDo.TableName() + _crpNPCCorporationResearchField.ALL = field.NewAsterisk(tableName) + _crpNPCCorporationResearchField.SkillID = field.NewInt32(tableName, "skillID") + _crpNPCCorporationResearchField.CorporationID = field.NewInt32(tableName, "corporationID") + + _crpNPCCorporationResearchField.fillFieldMap() + + return _crpNPCCorporationResearchField +} + +type crpNPCCorporationResearchField struct { + crpNPCCorporationResearchFieldDo crpNPCCorporationResearchFieldDo + + ALL field.Asterisk + SkillID field.Int32 + CorporationID field.Int32 + + fieldMap map[string]field.Expr +} + +func (c crpNPCCorporationResearchField) Table(newTableName string) *crpNPCCorporationResearchField { + c.crpNPCCorporationResearchFieldDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpNPCCorporationResearchField) As(alias string) *crpNPCCorporationResearchField { + c.crpNPCCorporationResearchFieldDo.DO = *(c.crpNPCCorporationResearchFieldDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpNPCCorporationResearchField) updateTableName(table string) *crpNPCCorporationResearchField { + c.ALL = field.NewAsterisk(table) + c.SkillID = field.NewInt32(table, "skillID") + c.CorporationID = field.NewInt32(table, "corporationID") + + c.fillFieldMap() + + return c +} + +func (c *crpNPCCorporationResearchField) WithContext(ctx context.Context) *crpNPCCorporationResearchFieldDo { + return c.crpNPCCorporationResearchFieldDo.WithContext(ctx) +} + +func (c crpNPCCorporationResearchField) TableName() string { + return c.crpNPCCorporationResearchFieldDo.TableName() +} + +func (c crpNPCCorporationResearchField) Alias() string { + return c.crpNPCCorporationResearchFieldDo.Alias() +} + +func (c crpNPCCorporationResearchField) Columns(cols ...field.Expr) gen.Columns { + return c.crpNPCCorporationResearchFieldDo.Columns(cols...) +} + +func (c *crpNPCCorporationResearchField) 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 *crpNPCCorporationResearchField) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 2) + c.fieldMap["skillID"] = c.SkillID + c.fieldMap["corporationID"] = c.CorporationID +} + +func (c crpNPCCorporationResearchField) clone(db *gorm.DB) crpNPCCorporationResearchField { + c.crpNPCCorporationResearchFieldDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpNPCCorporationResearchField) replaceDB(db *gorm.DB) crpNPCCorporationResearchField { + c.crpNPCCorporationResearchFieldDo.ReplaceDB(db) + return c +} + +type crpNPCCorporationResearchFieldDo struct{ gen.DO } + +func (c crpNPCCorporationResearchFieldDo) Debug() *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpNPCCorporationResearchFieldDo) WithContext(ctx context.Context) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpNPCCorporationResearchFieldDo) ReadDB() *crpNPCCorporationResearchFieldDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpNPCCorporationResearchFieldDo) WriteDB() *crpNPCCorporationResearchFieldDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpNPCCorporationResearchFieldDo) Session(config *gorm.Session) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpNPCCorporationResearchFieldDo) Clauses(conds ...clause.Expression) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Returning(value interface{}, columns ...string) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpNPCCorporationResearchFieldDo) Not(conds ...gen.Condition) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Or(conds ...gen.Condition) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Select(conds ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Where(conds ...gen.Condition) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Order(conds ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Distinct(cols ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpNPCCorporationResearchFieldDo) Omit(cols ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpNPCCorporationResearchFieldDo) Join(table schema.Tabler, on ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpNPCCorporationResearchFieldDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpNPCCorporationResearchFieldDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpNPCCorporationResearchFieldDo) Group(cols ...field.Expr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpNPCCorporationResearchFieldDo) Having(conds ...gen.Condition) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpNPCCorporationResearchFieldDo) Limit(limit int) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpNPCCorporationResearchFieldDo) Offset(offset int) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpNPCCorporationResearchFieldDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpNPCCorporationResearchFieldDo) Unscoped() *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpNPCCorporationResearchFieldDo) Create(values ...*models.CrpNPCCorporationResearchField) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpNPCCorporationResearchFieldDo) CreateInBatches(values []*models.CrpNPCCorporationResearchField, 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 crpNPCCorporationResearchFieldDo) Save(values ...*models.CrpNPCCorporationResearchField) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpNPCCorporationResearchFieldDo) First() (*models.CrpNPCCorporationResearchField, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationResearchField), nil + } +} + +func (c crpNPCCorporationResearchFieldDo) Take() (*models.CrpNPCCorporationResearchField, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationResearchField), nil + } +} + +func (c crpNPCCorporationResearchFieldDo) Last() (*models.CrpNPCCorporationResearchField, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationResearchField), nil + } +} + +func (c crpNPCCorporationResearchFieldDo) Find() ([]*models.CrpNPCCorporationResearchField, error) { + result, err := c.DO.Find() + return result.([]*models.CrpNPCCorporationResearchField), err +} + +func (c crpNPCCorporationResearchFieldDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpNPCCorporationResearchField, err error) { + buf := make([]*models.CrpNPCCorporationResearchField, 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 crpNPCCorporationResearchFieldDo) FindInBatches(result *[]*models.CrpNPCCorporationResearchField, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpNPCCorporationResearchFieldDo) Attrs(attrs ...field.AssignExpr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpNPCCorporationResearchFieldDo) Assign(attrs ...field.AssignExpr) *crpNPCCorporationResearchFieldDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpNPCCorporationResearchFieldDo) Joins(fields ...field.RelationField) *crpNPCCorporationResearchFieldDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpNPCCorporationResearchFieldDo) Preload(fields ...field.RelationField) *crpNPCCorporationResearchFieldDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpNPCCorporationResearchFieldDo) FirstOrInit() (*models.CrpNPCCorporationResearchField, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationResearchField), nil + } +} + +func (c crpNPCCorporationResearchFieldDo) FirstOrCreate() (*models.CrpNPCCorporationResearchField, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationResearchField), nil + } +} + +func (c crpNPCCorporationResearchFieldDo) FindByPage(offset int, limit int) (result []*models.CrpNPCCorporationResearchField, 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 crpNPCCorporationResearchFieldDo) 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 crpNPCCorporationResearchFieldDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpNPCCorporationResearchFieldDo) Delete(models ...*models.CrpNPCCorporationResearchField) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpNPCCorporationResearchFieldDo) withDO(do gen.Dao) *crpNPCCorporationResearchFieldDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpnpccorporations.gen.go b/models/crpnpccorporations.gen.go new file mode 100644 index 0000000..5a984a8 --- /dev/null +++ b/models/crpnpccorporations.gen.go @@ -0,0 +1,439 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpNPCCorporation(db *gorm.DB, opts ...gen.DOOption) crpNPCCorporation { + _crpNPCCorporation := crpNPCCorporation{} + + _crpNPCCorporation.crpNPCCorporationDo.UseDB(db, opts...) + _crpNPCCorporation.crpNPCCorporationDo.UseModel(&models.CrpNPCCorporation{}) + + tableName := _crpNPCCorporation.crpNPCCorporationDo.TableName() + _crpNPCCorporation.ALL = field.NewAsterisk(tableName) + _crpNPCCorporation.CorporationID = field.NewInt32(tableName, "corporationID") + _crpNPCCorporation.Size = field.NewString(tableName, "size") + _crpNPCCorporation.Extent = field.NewString(tableName, "extent") + _crpNPCCorporation.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _crpNPCCorporation.InvestorID1 = field.NewInt32(tableName, "investorID1") + _crpNPCCorporation.InvestorShares1 = field.NewInt32(tableName, "investorShares1") + _crpNPCCorporation.InvestorID2 = field.NewInt32(tableName, "investorID2") + _crpNPCCorporation.InvestorShares2 = field.NewInt32(tableName, "investorShares2") + _crpNPCCorporation.InvestorID3 = field.NewInt32(tableName, "investorID3") + _crpNPCCorporation.InvestorShares3 = field.NewInt32(tableName, "investorShares3") + _crpNPCCorporation.InvestorID4 = field.NewInt32(tableName, "investorID4") + _crpNPCCorporation.InvestorShares4 = field.NewInt32(tableName, "investorShares4") + _crpNPCCorporation.FriendID = field.NewInt32(tableName, "friendID") + _crpNPCCorporation.EnemyID = field.NewInt32(tableName, "enemyID") + _crpNPCCorporation.PublicShares = field.NewInt32(tableName, "publicShares") + _crpNPCCorporation.InitialPrice = field.NewInt32(tableName, "initialPrice") + _crpNPCCorporation.MinSecurity = field.NewFloat64(tableName, "minSecurity") + _crpNPCCorporation.Scattered = field.NewBool(tableName, "scattered") + _crpNPCCorporation.Fringe = field.NewInt32(tableName, "fringe") + _crpNPCCorporation.Corridor = field.NewInt32(tableName, "corridor") + _crpNPCCorporation.Hub = field.NewInt32(tableName, "hub") + _crpNPCCorporation.Border = field.NewInt32(tableName, "border") + _crpNPCCorporation.FactionID = field.NewInt32(tableName, "factionID") + _crpNPCCorporation.SizeFactor = field.NewFloat64(tableName, "sizeFactor") + _crpNPCCorporation.StationCount = field.NewInt32(tableName, "stationCount") + _crpNPCCorporation.StationSystemCount = field.NewInt32(tableName, "stationSystemCount") + _crpNPCCorporation.Description = field.NewString(tableName, "description") + _crpNPCCorporation.IconID = field.NewInt32(tableName, "iconID") + + _crpNPCCorporation.fillFieldMap() + + return _crpNPCCorporation +} + +type crpNPCCorporation struct { + crpNPCCorporationDo crpNPCCorporationDo + + ALL field.Asterisk + CorporationID field.Int32 + Size field.String + Extent field.String + SolarSystemID field.Int32 + InvestorID1 field.Int32 + InvestorShares1 field.Int32 + InvestorID2 field.Int32 + InvestorShares2 field.Int32 + InvestorID3 field.Int32 + InvestorShares3 field.Int32 + InvestorID4 field.Int32 + InvestorShares4 field.Int32 + FriendID field.Int32 + EnemyID field.Int32 + PublicShares field.Int32 + InitialPrice field.Int32 + MinSecurity field.Float64 + Scattered field.Bool + Fringe field.Int32 + Corridor field.Int32 + Hub field.Int32 + Border field.Int32 + FactionID field.Int32 + SizeFactor field.Float64 + StationCount field.Int32 + StationSystemCount field.Int32 + Description field.String + IconID field.Int32 + + fieldMap map[string]field.Expr +} + +func (c crpNPCCorporation) Table(newTableName string) *crpNPCCorporation { + c.crpNPCCorporationDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpNPCCorporation) As(alias string) *crpNPCCorporation { + c.crpNPCCorporationDo.DO = *(c.crpNPCCorporationDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpNPCCorporation) updateTableName(table string) *crpNPCCorporation { + c.ALL = field.NewAsterisk(table) + c.CorporationID = field.NewInt32(table, "corporationID") + c.Size = field.NewString(table, "size") + c.Extent = field.NewString(table, "extent") + c.SolarSystemID = field.NewInt32(table, "solarSystemID") + c.InvestorID1 = field.NewInt32(table, "investorID1") + c.InvestorShares1 = field.NewInt32(table, "investorShares1") + c.InvestorID2 = field.NewInt32(table, "investorID2") + c.InvestorShares2 = field.NewInt32(table, "investorShares2") + c.InvestorID3 = field.NewInt32(table, "investorID3") + c.InvestorShares3 = field.NewInt32(table, "investorShares3") + c.InvestorID4 = field.NewInt32(table, "investorID4") + c.InvestorShares4 = field.NewInt32(table, "investorShares4") + c.FriendID = field.NewInt32(table, "friendID") + c.EnemyID = field.NewInt32(table, "enemyID") + c.PublicShares = field.NewInt32(table, "publicShares") + c.InitialPrice = field.NewInt32(table, "initialPrice") + c.MinSecurity = field.NewFloat64(table, "minSecurity") + c.Scattered = field.NewBool(table, "scattered") + c.Fringe = field.NewInt32(table, "fringe") + c.Corridor = field.NewInt32(table, "corridor") + c.Hub = field.NewInt32(table, "hub") + c.Border = field.NewInt32(table, "border") + c.FactionID = field.NewInt32(table, "factionID") + c.SizeFactor = field.NewFloat64(table, "sizeFactor") + c.StationCount = field.NewInt32(table, "stationCount") + c.StationSystemCount = field.NewInt32(table, "stationSystemCount") + c.Description = field.NewString(table, "description") + c.IconID = field.NewInt32(table, "iconID") + + c.fillFieldMap() + + return c +} + +func (c *crpNPCCorporation) WithContext(ctx context.Context) *crpNPCCorporationDo { + return c.crpNPCCorporationDo.WithContext(ctx) +} + +func (c crpNPCCorporation) TableName() string { return c.crpNPCCorporationDo.TableName() } + +func (c crpNPCCorporation) Alias() string { return c.crpNPCCorporationDo.Alias() } + +func (c crpNPCCorporation) Columns(cols ...field.Expr) gen.Columns { + return c.crpNPCCorporationDo.Columns(cols...) +} + +func (c *crpNPCCorporation) 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 *crpNPCCorporation) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 28) + c.fieldMap["corporationID"] = c.CorporationID + c.fieldMap["size"] = c.Size + c.fieldMap["extent"] = c.Extent + c.fieldMap["solarSystemID"] = c.SolarSystemID + c.fieldMap["investorID1"] = c.InvestorID1 + c.fieldMap["investorShares1"] = c.InvestorShares1 + c.fieldMap["investorID2"] = c.InvestorID2 + c.fieldMap["investorShares2"] = c.InvestorShares2 + c.fieldMap["investorID3"] = c.InvestorID3 + c.fieldMap["investorShares3"] = c.InvestorShares3 + c.fieldMap["investorID4"] = c.InvestorID4 + c.fieldMap["investorShares4"] = c.InvestorShares4 + c.fieldMap["friendID"] = c.FriendID + c.fieldMap["enemyID"] = c.EnemyID + c.fieldMap["publicShares"] = c.PublicShares + c.fieldMap["initialPrice"] = c.InitialPrice + c.fieldMap["minSecurity"] = c.MinSecurity + c.fieldMap["scattered"] = c.Scattered + c.fieldMap["fringe"] = c.Fringe + c.fieldMap["corridor"] = c.Corridor + c.fieldMap["hub"] = c.Hub + c.fieldMap["border"] = c.Border + c.fieldMap["factionID"] = c.FactionID + c.fieldMap["sizeFactor"] = c.SizeFactor + c.fieldMap["stationCount"] = c.StationCount + c.fieldMap["stationSystemCount"] = c.StationSystemCount + c.fieldMap["description"] = c.Description + c.fieldMap["iconID"] = c.IconID +} + +func (c crpNPCCorporation) clone(db *gorm.DB) crpNPCCorporation { + c.crpNPCCorporationDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpNPCCorporation) replaceDB(db *gorm.DB) crpNPCCorporation { + c.crpNPCCorporationDo.ReplaceDB(db) + return c +} + +type crpNPCCorporationDo struct{ gen.DO } + +func (c crpNPCCorporationDo) Debug() *crpNPCCorporationDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpNPCCorporationDo) WithContext(ctx context.Context) *crpNPCCorporationDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpNPCCorporationDo) ReadDB() *crpNPCCorporationDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpNPCCorporationDo) WriteDB() *crpNPCCorporationDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpNPCCorporationDo) Session(config *gorm.Session) *crpNPCCorporationDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpNPCCorporationDo) Clauses(conds ...clause.Expression) *crpNPCCorporationDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpNPCCorporationDo) Returning(value interface{}, columns ...string) *crpNPCCorporationDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpNPCCorporationDo) Not(conds ...gen.Condition) *crpNPCCorporationDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpNPCCorporationDo) Or(conds ...gen.Condition) *crpNPCCorporationDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpNPCCorporationDo) Select(conds ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpNPCCorporationDo) Where(conds ...gen.Condition) *crpNPCCorporationDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpNPCCorporationDo) Order(conds ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpNPCCorporationDo) Distinct(cols ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpNPCCorporationDo) Omit(cols ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpNPCCorporationDo) Join(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpNPCCorporationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpNPCCorporationDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpNPCCorporationDo) Group(cols ...field.Expr) *crpNPCCorporationDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpNPCCorporationDo) Having(conds ...gen.Condition) *crpNPCCorporationDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpNPCCorporationDo) Limit(limit int) *crpNPCCorporationDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpNPCCorporationDo) Offset(offset int) *crpNPCCorporationDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpNPCCorporationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpNPCCorporationDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpNPCCorporationDo) Unscoped() *crpNPCCorporationDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpNPCCorporationDo) Create(values ...*models.CrpNPCCorporation) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpNPCCorporationDo) CreateInBatches(values []*models.CrpNPCCorporation, 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 crpNPCCorporationDo) Save(values ...*models.CrpNPCCorporation) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpNPCCorporationDo) First() (*models.CrpNPCCorporation, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporation), nil + } +} + +func (c crpNPCCorporationDo) Take() (*models.CrpNPCCorporation, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporation), nil + } +} + +func (c crpNPCCorporationDo) Last() (*models.CrpNPCCorporation, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporation), nil + } +} + +func (c crpNPCCorporationDo) Find() ([]*models.CrpNPCCorporation, error) { + result, err := c.DO.Find() + return result.([]*models.CrpNPCCorporation), err +} + +func (c crpNPCCorporationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpNPCCorporation, err error) { + buf := make([]*models.CrpNPCCorporation, 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 crpNPCCorporationDo) FindInBatches(result *[]*models.CrpNPCCorporation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpNPCCorporationDo) Attrs(attrs ...field.AssignExpr) *crpNPCCorporationDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpNPCCorporationDo) Assign(attrs ...field.AssignExpr) *crpNPCCorporationDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpNPCCorporationDo) Joins(fields ...field.RelationField) *crpNPCCorporationDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpNPCCorporationDo) Preload(fields ...field.RelationField) *crpNPCCorporationDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpNPCCorporationDo) FirstOrInit() (*models.CrpNPCCorporation, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporation), nil + } +} + +func (c crpNPCCorporationDo) FirstOrCreate() (*models.CrpNPCCorporation, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporation), nil + } +} + +func (c crpNPCCorporationDo) FindByPage(offset int, limit int) (result []*models.CrpNPCCorporation, 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 crpNPCCorporationDo) 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 crpNPCCorporationDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpNPCCorporationDo) Delete(models ...*models.CrpNPCCorporation) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpNPCCorporationDo) withDO(do gen.Dao) *crpNPCCorporationDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpnpccorporationtrades.gen.go b/models/crpnpccorporationtrades.gen.go new file mode 100644 index 0000000..24f6ef2 --- /dev/null +++ b/models/crpnpccorporationtrades.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpNPCCorporationTrade(db *gorm.DB, opts ...gen.DOOption) crpNPCCorporationTrade { + _crpNPCCorporationTrade := crpNPCCorporationTrade{} + + _crpNPCCorporationTrade.crpNPCCorporationTradeDo.UseDB(db, opts...) + _crpNPCCorporationTrade.crpNPCCorporationTradeDo.UseModel(&models.CrpNPCCorporationTrade{}) + + tableName := _crpNPCCorporationTrade.crpNPCCorporationTradeDo.TableName() + _crpNPCCorporationTrade.ALL = field.NewAsterisk(tableName) + _crpNPCCorporationTrade.CorporationID = field.NewInt32(tableName, "corporationID") + _crpNPCCorporationTrade.TypeID = field.NewInt32(tableName, "typeID") + + _crpNPCCorporationTrade.fillFieldMap() + + return _crpNPCCorporationTrade +} + +type crpNPCCorporationTrade struct { + crpNPCCorporationTradeDo crpNPCCorporationTradeDo + + ALL field.Asterisk + CorporationID field.Int32 + TypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (c crpNPCCorporationTrade) Table(newTableName string) *crpNPCCorporationTrade { + c.crpNPCCorporationTradeDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpNPCCorporationTrade) As(alias string) *crpNPCCorporationTrade { + c.crpNPCCorporationTradeDo.DO = *(c.crpNPCCorporationTradeDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpNPCCorporationTrade) updateTableName(table string) *crpNPCCorporationTrade { + c.ALL = field.NewAsterisk(table) + c.CorporationID = field.NewInt32(table, "corporationID") + c.TypeID = field.NewInt32(table, "typeID") + + c.fillFieldMap() + + return c +} + +func (c *crpNPCCorporationTrade) WithContext(ctx context.Context) *crpNPCCorporationTradeDo { + return c.crpNPCCorporationTradeDo.WithContext(ctx) +} + +func (c crpNPCCorporationTrade) TableName() string { return c.crpNPCCorporationTradeDo.TableName() } + +func (c crpNPCCorporationTrade) Alias() string { return c.crpNPCCorporationTradeDo.Alias() } + +func (c crpNPCCorporationTrade) Columns(cols ...field.Expr) gen.Columns { + return c.crpNPCCorporationTradeDo.Columns(cols...) +} + +func (c *crpNPCCorporationTrade) 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 *crpNPCCorporationTrade) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 2) + c.fieldMap["corporationID"] = c.CorporationID + c.fieldMap["typeID"] = c.TypeID +} + +func (c crpNPCCorporationTrade) clone(db *gorm.DB) crpNPCCorporationTrade { + c.crpNPCCorporationTradeDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpNPCCorporationTrade) replaceDB(db *gorm.DB) crpNPCCorporationTrade { + c.crpNPCCorporationTradeDo.ReplaceDB(db) + return c +} + +type crpNPCCorporationTradeDo struct{ gen.DO } + +func (c crpNPCCorporationTradeDo) Debug() *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpNPCCorporationTradeDo) WithContext(ctx context.Context) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpNPCCorporationTradeDo) ReadDB() *crpNPCCorporationTradeDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpNPCCorporationTradeDo) WriteDB() *crpNPCCorporationTradeDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpNPCCorporationTradeDo) Session(config *gorm.Session) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpNPCCorporationTradeDo) Clauses(conds ...clause.Expression) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpNPCCorporationTradeDo) Returning(value interface{}, columns ...string) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpNPCCorporationTradeDo) Not(conds ...gen.Condition) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpNPCCorporationTradeDo) Or(conds ...gen.Condition) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpNPCCorporationTradeDo) Select(conds ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpNPCCorporationTradeDo) Where(conds ...gen.Condition) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpNPCCorporationTradeDo) Order(conds ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpNPCCorporationTradeDo) Distinct(cols ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpNPCCorporationTradeDo) Omit(cols ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpNPCCorporationTradeDo) Join(table schema.Tabler, on ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpNPCCorporationTradeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpNPCCorporationTradeDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpNPCCorporationTradeDo) Group(cols ...field.Expr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpNPCCorporationTradeDo) Having(conds ...gen.Condition) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpNPCCorporationTradeDo) Limit(limit int) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpNPCCorporationTradeDo) Offset(offset int) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpNPCCorporationTradeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpNPCCorporationTradeDo) Unscoped() *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpNPCCorporationTradeDo) Create(values ...*models.CrpNPCCorporationTrade) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpNPCCorporationTradeDo) CreateInBatches(values []*models.CrpNPCCorporationTrade, 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 crpNPCCorporationTradeDo) Save(values ...*models.CrpNPCCorporationTrade) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpNPCCorporationTradeDo) First() (*models.CrpNPCCorporationTrade, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationTrade), nil + } +} + +func (c crpNPCCorporationTradeDo) Take() (*models.CrpNPCCorporationTrade, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationTrade), nil + } +} + +func (c crpNPCCorporationTradeDo) Last() (*models.CrpNPCCorporationTrade, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationTrade), nil + } +} + +func (c crpNPCCorporationTradeDo) Find() ([]*models.CrpNPCCorporationTrade, error) { + result, err := c.DO.Find() + return result.([]*models.CrpNPCCorporationTrade), err +} + +func (c crpNPCCorporationTradeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpNPCCorporationTrade, err error) { + buf := make([]*models.CrpNPCCorporationTrade, 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 crpNPCCorporationTradeDo) FindInBatches(result *[]*models.CrpNPCCorporationTrade, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpNPCCorporationTradeDo) Attrs(attrs ...field.AssignExpr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpNPCCorporationTradeDo) Assign(attrs ...field.AssignExpr) *crpNPCCorporationTradeDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpNPCCorporationTradeDo) Joins(fields ...field.RelationField) *crpNPCCorporationTradeDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpNPCCorporationTradeDo) Preload(fields ...field.RelationField) *crpNPCCorporationTradeDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpNPCCorporationTradeDo) FirstOrInit() (*models.CrpNPCCorporationTrade, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationTrade), nil + } +} + +func (c crpNPCCorporationTradeDo) FirstOrCreate() (*models.CrpNPCCorporationTrade, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCCorporationTrade), nil + } +} + +func (c crpNPCCorporationTradeDo) FindByPage(offset int, limit int) (result []*models.CrpNPCCorporationTrade, 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 crpNPCCorporationTradeDo) 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 crpNPCCorporationTradeDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpNPCCorporationTradeDo) Delete(models ...*models.CrpNPCCorporationTrade) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpNPCCorporationTradeDo) withDO(do gen.Dao) *crpNPCCorporationTradeDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/crpnpcdivisions.gen.go b/models/crpnpcdivisions.gen.go new file mode 100644 index 0000000..9f31b9d --- /dev/null +++ b/models/crpnpcdivisions.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newCrpNPCDivision(db *gorm.DB, opts ...gen.DOOption) crpNPCDivision { + _crpNPCDivision := crpNPCDivision{} + + _crpNPCDivision.crpNPCDivisionDo.UseDB(db, opts...) + _crpNPCDivision.crpNPCDivisionDo.UseModel(&models.CrpNPCDivision{}) + + tableName := _crpNPCDivision.crpNPCDivisionDo.TableName() + _crpNPCDivision.ALL = field.NewAsterisk(tableName) + _crpNPCDivision.DivisionID = field.NewInt32(tableName, "divisionID") + _crpNPCDivision.DivisionName = field.NewString(tableName, "divisionName") + _crpNPCDivision.Description = field.NewString(tableName, "description") + _crpNPCDivision.LeaderType = field.NewString(tableName, "leaderType") + + _crpNPCDivision.fillFieldMap() + + return _crpNPCDivision +} + +type crpNPCDivision struct { + crpNPCDivisionDo crpNPCDivisionDo + + ALL field.Asterisk + DivisionID field.Int32 + DivisionName field.String + Description field.String + LeaderType field.String + + fieldMap map[string]field.Expr +} + +func (c crpNPCDivision) Table(newTableName string) *crpNPCDivision { + c.crpNPCDivisionDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c crpNPCDivision) As(alias string) *crpNPCDivision { + c.crpNPCDivisionDo.DO = *(c.crpNPCDivisionDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *crpNPCDivision) updateTableName(table string) *crpNPCDivision { + c.ALL = field.NewAsterisk(table) + c.DivisionID = field.NewInt32(table, "divisionID") + c.DivisionName = field.NewString(table, "divisionName") + c.Description = field.NewString(table, "description") + c.LeaderType = field.NewString(table, "leaderType") + + c.fillFieldMap() + + return c +} + +func (c *crpNPCDivision) WithContext(ctx context.Context) *crpNPCDivisionDo { + return c.crpNPCDivisionDo.WithContext(ctx) +} + +func (c crpNPCDivision) TableName() string { return c.crpNPCDivisionDo.TableName() } + +func (c crpNPCDivision) Alias() string { return c.crpNPCDivisionDo.Alias() } + +func (c crpNPCDivision) Columns(cols ...field.Expr) gen.Columns { + return c.crpNPCDivisionDo.Columns(cols...) +} + +func (c *crpNPCDivision) 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 *crpNPCDivision) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 4) + c.fieldMap["divisionID"] = c.DivisionID + c.fieldMap["divisionName"] = c.DivisionName + c.fieldMap["description"] = c.Description + c.fieldMap["leaderType"] = c.LeaderType +} + +func (c crpNPCDivision) clone(db *gorm.DB) crpNPCDivision { + c.crpNPCDivisionDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c crpNPCDivision) replaceDB(db *gorm.DB) crpNPCDivision { + c.crpNPCDivisionDo.ReplaceDB(db) + return c +} + +type crpNPCDivisionDo struct{ gen.DO } + +func (c crpNPCDivisionDo) Debug() *crpNPCDivisionDo { + return c.withDO(c.DO.Debug()) +} + +func (c crpNPCDivisionDo) WithContext(ctx context.Context) *crpNPCDivisionDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c crpNPCDivisionDo) ReadDB() *crpNPCDivisionDo { + return c.Clauses(dbresolver.Read) +} + +func (c crpNPCDivisionDo) WriteDB() *crpNPCDivisionDo { + return c.Clauses(dbresolver.Write) +} + +func (c crpNPCDivisionDo) Session(config *gorm.Session) *crpNPCDivisionDo { + return c.withDO(c.DO.Session(config)) +} + +func (c crpNPCDivisionDo) Clauses(conds ...clause.Expression) *crpNPCDivisionDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c crpNPCDivisionDo) Returning(value interface{}, columns ...string) *crpNPCDivisionDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c crpNPCDivisionDo) Not(conds ...gen.Condition) *crpNPCDivisionDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c crpNPCDivisionDo) Or(conds ...gen.Condition) *crpNPCDivisionDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c crpNPCDivisionDo) Select(conds ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c crpNPCDivisionDo) Where(conds ...gen.Condition) *crpNPCDivisionDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c crpNPCDivisionDo) Order(conds ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c crpNPCDivisionDo) Distinct(cols ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c crpNPCDivisionDo) Omit(cols ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c crpNPCDivisionDo) Join(table schema.Tabler, on ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c crpNPCDivisionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c crpNPCDivisionDo) RightJoin(table schema.Tabler, on ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c crpNPCDivisionDo) Group(cols ...field.Expr) *crpNPCDivisionDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c crpNPCDivisionDo) Having(conds ...gen.Condition) *crpNPCDivisionDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c crpNPCDivisionDo) Limit(limit int) *crpNPCDivisionDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c crpNPCDivisionDo) Offset(offset int) *crpNPCDivisionDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c crpNPCDivisionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *crpNPCDivisionDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c crpNPCDivisionDo) Unscoped() *crpNPCDivisionDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c crpNPCDivisionDo) Create(values ...*models.CrpNPCDivision) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c crpNPCDivisionDo) CreateInBatches(values []*models.CrpNPCDivision, 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 crpNPCDivisionDo) Save(values ...*models.CrpNPCDivision) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c crpNPCDivisionDo) First() (*models.CrpNPCDivision, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCDivision), nil + } +} + +func (c crpNPCDivisionDo) Take() (*models.CrpNPCDivision, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCDivision), nil + } +} + +func (c crpNPCDivisionDo) Last() (*models.CrpNPCDivision, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCDivision), nil + } +} + +func (c crpNPCDivisionDo) Find() ([]*models.CrpNPCDivision, error) { + result, err := c.DO.Find() + return result.([]*models.CrpNPCDivision), err +} + +func (c crpNPCDivisionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CrpNPCDivision, err error) { + buf := make([]*models.CrpNPCDivision, 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 crpNPCDivisionDo) FindInBatches(result *[]*models.CrpNPCDivision, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c crpNPCDivisionDo) Attrs(attrs ...field.AssignExpr) *crpNPCDivisionDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c crpNPCDivisionDo) Assign(attrs ...field.AssignExpr) *crpNPCDivisionDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c crpNPCDivisionDo) Joins(fields ...field.RelationField) *crpNPCDivisionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c crpNPCDivisionDo) Preload(fields ...field.RelationField) *crpNPCDivisionDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c crpNPCDivisionDo) FirstOrInit() (*models.CrpNPCDivision, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCDivision), nil + } +} + +func (c crpNPCDivisionDo) FirstOrCreate() (*models.CrpNPCDivision, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.CrpNPCDivision), nil + } +} + +func (c crpNPCDivisionDo) FindByPage(offset int, limit int) (result []*models.CrpNPCDivision, 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 crpNPCDivisionDo) 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 crpNPCDivisionDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c crpNPCDivisionDo) Delete(models ...*models.CrpNPCDivision) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *crpNPCDivisionDo) withDO(do gen.Dao) *crpNPCDivisionDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/models/dgmattributecategories.gen.go b/models/dgmattributecategories.gen.go new file mode 100644 index 0000000..0aa63d0 --- /dev/null +++ b/models/dgmattributecategories.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmAttributeCategory(db *gorm.DB, opts ...gen.DOOption) dgmAttributeCategory { + _dgmAttributeCategory := dgmAttributeCategory{} + + _dgmAttributeCategory.dgmAttributeCategoryDo.UseDB(db, opts...) + _dgmAttributeCategory.dgmAttributeCategoryDo.UseModel(&models.DgmAttributeCategory{}) + + tableName := _dgmAttributeCategory.dgmAttributeCategoryDo.TableName() + _dgmAttributeCategory.ALL = field.NewAsterisk(tableName) + _dgmAttributeCategory.CategoryID = field.NewInt32(tableName, "categoryID") + _dgmAttributeCategory.CategoryName = field.NewString(tableName, "categoryName") + _dgmAttributeCategory.CategoryDescription = field.NewString(tableName, "categoryDescription") + + _dgmAttributeCategory.fillFieldMap() + + return _dgmAttributeCategory +} + +type dgmAttributeCategory struct { + dgmAttributeCategoryDo dgmAttributeCategoryDo + + ALL field.Asterisk + CategoryID field.Int32 + CategoryName field.String + CategoryDescription field.String + + fieldMap map[string]field.Expr +} + +func (d dgmAttributeCategory) Table(newTableName string) *dgmAttributeCategory { + d.dgmAttributeCategoryDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmAttributeCategory) As(alias string) *dgmAttributeCategory { + d.dgmAttributeCategoryDo.DO = *(d.dgmAttributeCategoryDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmAttributeCategory) updateTableName(table string) *dgmAttributeCategory { + d.ALL = field.NewAsterisk(table) + d.CategoryID = field.NewInt32(table, "categoryID") + d.CategoryName = field.NewString(table, "categoryName") + d.CategoryDescription = field.NewString(table, "categoryDescription") + + d.fillFieldMap() + + return d +} + +func (d *dgmAttributeCategory) WithContext(ctx context.Context) *dgmAttributeCategoryDo { + return d.dgmAttributeCategoryDo.WithContext(ctx) +} + +func (d dgmAttributeCategory) TableName() string { return d.dgmAttributeCategoryDo.TableName() } + +func (d dgmAttributeCategory) Alias() string { return d.dgmAttributeCategoryDo.Alias() } + +func (d dgmAttributeCategory) Columns(cols ...field.Expr) gen.Columns { + return d.dgmAttributeCategoryDo.Columns(cols...) +} + +func (d *dgmAttributeCategory) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmAttributeCategory) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 3) + d.fieldMap["categoryID"] = d.CategoryID + d.fieldMap["categoryName"] = d.CategoryName + d.fieldMap["categoryDescription"] = d.CategoryDescription +} + +func (d dgmAttributeCategory) clone(db *gorm.DB) dgmAttributeCategory { + d.dgmAttributeCategoryDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmAttributeCategory) replaceDB(db *gorm.DB) dgmAttributeCategory { + d.dgmAttributeCategoryDo.ReplaceDB(db) + return d +} + +type dgmAttributeCategoryDo struct{ gen.DO } + +func (d dgmAttributeCategoryDo) Debug() *dgmAttributeCategoryDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmAttributeCategoryDo) WithContext(ctx context.Context) *dgmAttributeCategoryDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmAttributeCategoryDo) ReadDB() *dgmAttributeCategoryDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmAttributeCategoryDo) WriteDB() *dgmAttributeCategoryDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmAttributeCategoryDo) Session(config *gorm.Session) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmAttributeCategoryDo) Clauses(conds ...clause.Expression) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmAttributeCategoryDo) Returning(value interface{}, columns ...string) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmAttributeCategoryDo) Not(conds ...gen.Condition) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmAttributeCategoryDo) Or(conds ...gen.Condition) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmAttributeCategoryDo) Select(conds ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmAttributeCategoryDo) Where(conds ...gen.Condition) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmAttributeCategoryDo) Order(conds ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmAttributeCategoryDo) Distinct(cols ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmAttributeCategoryDo) Omit(cols ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmAttributeCategoryDo) Join(table schema.Tabler, on ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmAttributeCategoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmAttributeCategoryDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmAttributeCategoryDo) Group(cols ...field.Expr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmAttributeCategoryDo) Having(conds ...gen.Condition) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmAttributeCategoryDo) Limit(limit int) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmAttributeCategoryDo) Offset(offset int) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmAttributeCategoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmAttributeCategoryDo) Unscoped() *dgmAttributeCategoryDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmAttributeCategoryDo) Create(values ...*models.DgmAttributeCategory) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmAttributeCategoryDo) CreateInBatches(values []*models.DgmAttributeCategory, batchSize int) error { + return d.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 (d dgmAttributeCategoryDo) Save(values ...*models.DgmAttributeCategory) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmAttributeCategoryDo) First() (*models.DgmAttributeCategory, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeCategory), nil + } +} + +func (d dgmAttributeCategoryDo) Take() (*models.DgmAttributeCategory, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeCategory), nil + } +} + +func (d dgmAttributeCategoryDo) Last() (*models.DgmAttributeCategory, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeCategory), nil + } +} + +func (d dgmAttributeCategoryDo) Find() ([]*models.DgmAttributeCategory, error) { + result, err := d.DO.Find() + return result.([]*models.DgmAttributeCategory), err +} + +func (d dgmAttributeCategoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmAttributeCategory, err error) { + buf := make([]*models.DgmAttributeCategory, 0, batchSize) + err = d.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 (d dgmAttributeCategoryDo) FindInBatches(result *[]*models.DgmAttributeCategory, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmAttributeCategoryDo) Attrs(attrs ...field.AssignExpr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmAttributeCategoryDo) Assign(attrs ...field.AssignExpr) *dgmAttributeCategoryDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmAttributeCategoryDo) Joins(fields ...field.RelationField) *dgmAttributeCategoryDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmAttributeCategoryDo) Preload(fields ...field.RelationField) *dgmAttributeCategoryDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmAttributeCategoryDo) FirstOrInit() (*models.DgmAttributeCategory, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeCategory), nil + } +} + +func (d dgmAttributeCategoryDo) FirstOrCreate() (*models.DgmAttributeCategory, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeCategory), nil + } +} + +func (d dgmAttributeCategoryDo) FindByPage(offset int, limit int) (result []*models.DgmAttributeCategory, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmAttributeCategoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmAttributeCategoryDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmAttributeCategoryDo) Delete(models ...*models.DgmAttributeCategory) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmAttributeCategoryDo) withDO(do gen.Dao) *dgmAttributeCategoryDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/dgmattributetypes.gen.go b/models/dgmattributetypes.gen.go new file mode 100644 index 0000000..b611e72 --- /dev/null +++ b/models/dgmattributetypes.gen.go @@ -0,0 +1,371 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmAttributeType(db *gorm.DB, opts ...gen.DOOption) dgmAttributeType { + _dgmAttributeType := dgmAttributeType{} + + _dgmAttributeType.dgmAttributeTypeDo.UseDB(db, opts...) + _dgmAttributeType.dgmAttributeTypeDo.UseModel(&models.DgmAttributeType{}) + + tableName := _dgmAttributeType.dgmAttributeTypeDo.TableName() + _dgmAttributeType.ALL = field.NewAsterisk(tableName) + _dgmAttributeType.AttributeID = field.NewInt32(tableName, "attributeID") + _dgmAttributeType.AttributeName = field.NewString(tableName, "attributeName") + _dgmAttributeType.Description = field.NewString(tableName, "description") + _dgmAttributeType.IconID = field.NewInt32(tableName, "iconID") + _dgmAttributeType.DefaultValue = field.NewFloat64(tableName, "defaultValue") + _dgmAttributeType.Published = field.NewBool(tableName, "published") + _dgmAttributeType.DisplayName = field.NewString(tableName, "displayName") + _dgmAttributeType.UnitID = field.NewInt32(tableName, "unitID") + _dgmAttributeType.Stackable = field.NewBool(tableName, "stackable") + _dgmAttributeType.HighIsGood = field.NewBool(tableName, "highIsGood") + _dgmAttributeType.CategoryID = field.NewInt32(tableName, "categoryID") + + _dgmAttributeType.fillFieldMap() + + return _dgmAttributeType +} + +type dgmAttributeType struct { + dgmAttributeTypeDo dgmAttributeTypeDo + + ALL field.Asterisk + AttributeID field.Int32 + AttributeName field.String + Description field.String + IconID field.Int32 + DefaultValue field.Float64 + Published field.Bool + DisplayName field.String + UnitID field.Int32 + Stackable field.Bool + HighIsGood field.Bool + CategoryID field.Int32 + + fieldMap map[string]field.Expr +} + +func (d dgmAttributeType) Table(newTableName string) *dgmAttributeType { + d.dgmAttributeTypeDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmAttributeType) As(alias string) *dgmAttributeType { + d.dgmAttributeTypeDo.DO = *(d.dgmAttributeTypeDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmAttributeType) updateTableName(table string) *dgmAttributeType { + d.ALL = field.NewAsterisk(table) + d.AttributeID = field.NewInt32(table, "attributeID") + d.AttributeName = field.NewString(table, "attributeName") + d.Description = field.NewString(table, "description") + d.IconID = field.NewInt32(table, "iconID") + d.DefaultValue = field.NewFloat64(table, "defaultValue") + d.Published = field.NewBool(table, "published") + d.DisplayName = field.NewString(table, "displayName") + d.UnitID = field.NewInt32(table, "unitID") + d.Stackable = field.NewBool(table, "stackable") + d.HighIsGood = field.NewBool(table, "highIsGood") + d.CategoryID = field.NewInt32(table, "categoryID") + + d.fillFieldMap() + + return d +} + +func (d *dgmAttributeType) WithContext(ctx context.Context) *dgmAttributeTypeDo { + return d.dgmAttributeTypeDo.WithContext(ctx) +} + +func (d dgmAttributeType) TableName() string { return d.dgmAttributeTypeDo.TableName() } + +func (d dgmAttributeType) Alias() string { return d.dgmAttributeTypeDo.Alias() } + +func (d dgmAttributeType) Columns(cols ...field.Expr) gen.Columns { + return d.dgmAttributeTypeDo.Columns(cols...) +} + +func (d *dgmAttributeType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmAttributeType) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 11) + d.fieldMap["attributeID"] = d.AttributeID + d.fieldMap["attributeName"] = d.AttributeName + d.fieldMap["description"] = d.Description + d.fieldMap["iconID"] = d.IconID + d.fieldMap["defaultValue"] = d.DefaultValue + d.fieldMap["published"] = d.Published + d.fieldMap["displayName"] = d.DisplayName + d.fieldMap["unitID"] = d.UnitID + d.fieldMap["stackable"] = d.Stackable + d.fieldMap["highIsGood"] = d.HighIsGood + d.fieldMap["categoryID"] = d.CategoryID +} + +func (d dgmAttributeType) clone(db *gorm.DB) dgmAttributeType { + d.dgmAttributeTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmAttributeType) replaceDB(db *gorm.DB) dgmAttributeType { + d.dgmAttributeTypeDo.ReplaceDB(db) + return d +} + +type dgmAttributeTypeDo struct{ gen.DO } + +func (d dgmAttributeTypeDo) Debug() *dgmAttributeTypeDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmAttributeTypeDo) WithContext(ctx context.Context) *dgmAttributeTypeDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmAttributeTypeDo) ReadDB() *dgmAttributeTypeDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmAttributeTypeDo) WriteDB() *dgmAttributeTypeDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmAttributeTypeDo) Session(config *gorm.Session) *dgmAttributeTypeDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmAttributeTypeDo) Clauses(conds ...clause.Expression) *dgmAttributeTypeDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmAttributeTypeDo) Returning(value interface{}, columns ...string) *dgmAttributeTypeDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmAttributeTypeDo) Not(conds ...gen.Condition) *dgmAttributeTypeDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmAttributeTypeDo) Or(conds ...gen.Condition) *dgmAttributeTypeDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmAttributeTypeDo) Select(conds ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmAttributeTypeDo) Where(conds ...gen.Condition) *dgmAttributeTypeDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmAttributeTypeDo) Order(conds ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmAttributeTypeDo) Distinct(cols ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmAttributeTypeDo) Omit(cols ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmAttributeTypeDo) Join(table schema.Tabler, on ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmAttributeTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmAttributeTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmAttributeTypeDo) Group(cols ...field.Expr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmAttributeTypeDo) Having(conds ...gen.Condition) *dgmAttributeTypeDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmAttributeTypeDo) Limit(limit int) *dgmAttributeTypeDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmAttributeTypeDo) Offset(offset int) *dgmAttributeTypeDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmAttributeTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmAttributeTypeDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmAttributeTypeDo) Unscoped() *dgmAttributeTypeDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmAttributeTypeDo) Create(values ...*models.DgmAttributeType) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmAttributeTypeDo) CreateInBatches(values []*models.DgmAttributeType, batchSize int) error { + return d.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 (d dgmAttributeTypeDo) Save(values ...*models.DgmAttributeType) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmAttributeTypeDo) First() (*models.DgmAttributeType, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeType), nil + } +} + +func (d dgmAttributeTypeDo) Take() (*models.DgmAttributeType, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeType), nil + } +} + +func (d dgmAttributeTypeDo) Last() (*models.DgmAttributeType, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeType), nil + } +} + +func (d dgmAttributeTypeDo) Find() ([]*models.DgmAttributeType, error) { + result, err := d.DO.Find() + return result.([]*models.DgmAttributeType), err +} + +func (d dgmAttributeTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmAttributeType, err error) { + buf := make([]*models.DgmAttributeType, 0, batchSize) + err = d.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 (d dgmAttributeTypeDo) FindInBatches(result *[]*models.DgmAttributeType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmAttributeTypeDo) Attrs(attrs ...field.AssignExpr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmAttributeTypeDo) Assign(attrs ...field.AssignExpr) *dgmAttributeTypeDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmAttributeTypeDo) Joins(fields ...field.RelationField) *dgmAttributeTypeDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmAttributeTypeDo) Preload(fields ...field.RelationField) *dgmAttributeTypeDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmAttributeTypeDo) FirstOrInit() (*models.DgmAttributeType, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeType), nil + } +} + +func (d dgmAttributeTypeDo) FirstOrCreate() (*models.DgmAttributeType, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmAttributeType), nil + } +} + +func (d dgmAttributeTypeDo) FindByPage(offset int, limit int) (result []*models.DgmAttributeType, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmAttributeTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmAttributeTypeDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmAttributeTypeDo) Delete(models ...*models.DgmAttributeType) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmAttributeTypeDo) withDO(do gen.Dao) *dgmAttributeTypeDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/dgmeffects.gen.go b/models/dgmeffects.gen.go new file mode 100644 index 0000000..6906824 --- /dev/null +++ b/models/dgmeffects.gen.go @@ -0,0 +1,437 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmEffect(db *gorm.DB, opts ...gen.DOOption) dgmEffect { + _dgmEffect := dgmEffect{} + + _dgmEffect.dgmEffectDo.UseDB(db, opts...) + _dgmEffect.dgmEffectDo.UseModel(&models.DgmEffect{}) + + tableName := _dgmEffect.dgmEffectDo.TableName() + _dgmEffect.ALL = field.NewAsterisk(tableName) + _dgmEffect.EffectID = field.NewInt32(tableName, "effectID") + _dgmEffect.EffectName = field.NewString(tableName, "effectName") + _dgmEffect.EffectCategory = field.NewInt32(tableName, "effectCategory") + _dgmEffect.PreExpression = field.NewInt32(tableName, "preExpression") + _dgmEffect.PostExpression = field.NewInt32(tableName, "postExpression") + _dgmEffect.Description = field.NewString(tableName, "description") + _dgmEffect.GUID = field.NewString(tableName, "guid") + _dgmEffect.IconID = field.NewInt32(tableName, "iconID") + _dgmEffect.IsOffensive = field.NewBool(tableName, "isOffensive") + _dgmEffect.IsAssistance = field.NewBool(tableName, "isAssistance") + _dgmEffect.DurationAttributeID = field.NewInt32(tableName, "durationAttributeID") + _dgmEffect.TrackingSpeedAttributeID = field.NewInt32(tableName, "trackingSpeedAttributeID") + _dgmEffect.DischargeAttributeID = field.NewInt32(tableName, "dischargeAttributeID") + _dgmEffect.RangeAttributeID = field.NewInt32(tableName, "rangeAttributeID") + _dgmEffect.FalloffAttributeID = field.NewInt32(tableName, "falloffAttributeID") + _dgmEffect.DisallowAutoRepeat = field.NewBool(tableName, "disallowAutoRepeat") + _dgmEffect.Published = field.NewBool(tableName, "published") + _dgmEffect.DisplayName = field.NewString(tableName, "displayName") + _dgmEffect.IsWarpSafe = field.NewBool(tableName, "isWarpSafe") + _dgmEffect.RangeChance = field.NewBool(tableName, "rangeChance") + _dgmEffect.ElectronicChance = field.NewBool(tableName, "electronicChance") + _dgmEffect.PropulsionChance = field.NewBool(tableName, "propulsionChance") + _dgmEffect.Distribution = field.NewInt32(tableName, "distribution") + _dgmEffect.SfxName = field.NewString(tableName, "sfxName") + _dgmEffect.NpcUsageChanceAttributeID = field.NewInt32(tableName, "npcUsageChanceAttributeID") + _dgmEffect.NpcActivationChanceAttributeID = field.NewInt32(tableName, "npcActivationChanceAttributeID") + _dgmEffect.FittingUsageChanceAttributeID = field.NewInt32(tableName, "fittingUsageChanceAttributeID") + _dgmEffect.ModifierInfo = field.NewString(tableName, "modifierInfo") + + _dgmEffect.fillFieldMap() + + return _dgmEffect +} + +type dgmEffect struct { + dgmEffectDo dgmEffectDo + + ALL field.Asterisk + EffectID field.Int32 + EffectName field.String + EffectCategory field.Int32 + PreExpression field.Int32 + PostExpression field.Int32 + Description field.String + GUID field.String + IconID field.Int32 + IsOffensive field.Bool + IsAssistance field.Bool + DurationAttributeID field.Int32 + TrackingSpeedAttributeID field.Int32 + DischargeAttributeID field.Int32 + RangeAttributeID field.Int32 + FalloffAttributeID field.Int32 + DisallowAutoRepeat field.Bool + Published field.Bool + DisplayName field.String + IsWarpSafe field.Bool + RangeChance field.Bool + ElectronicChance field.Bool + PropulsionChance field.Bool + Distribution field.Int32 + SfxName field.String + NpcUsageChanceAttributeID field.Int32 + NpcActivationChanceAttributeID field.Int32 + FittingUsageChanceAttributeID field.Int32 + ModifierInfo field.String + + fieldMap map[string]field.Expr +} + +func (d dgmEffect) Table(newTableName string) *dgmEffect { + d.dgmEffectDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmEffect) As(alias string) *dgmEffect { + d.dgmEffectDo.DO = *(d.dgmEffectDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmEffect) updateTableName(table string) *dgmEffect { + d.ALL = field.NewAsterisk(table) + d.EffectID = field.NewInt32(table, "effectID") + d.EffectName = field.NewString(table, "effectName") + d.EffectCategory = field.NewInt32(table, "effectCategory") + d.PreExpression = field.NewInt32(table, "preExpression") + d.PostExpression = field.NewInt32(table, "postExpression") + d.Description = field.NewString(table, "description") + d.GUID = field.NewString(table, "guid") + d.IconID = field.NewInt32(table, "iconID") + d.IsOffensive = field.NewBool(table, "isOffensive") + d.IsAssistance = field.NewBool(table, "isAssistance") + d.DurationAttributeID = field.NewInt32(table, "durationAttributeID") + d.TrackingSpeedAttributeID = field.NewInt32(table, "trackingSpeedAttributeID") + d.DischargeAttributeID = field.NewInt32(table, "dischargeAttributeID") + d.RangeAttributeID = field.NewInt32(table, "rangeAttributeID") + d.FalloffAttributeID = field.NewInt32(table, "falloffAttributeID") + d.DisallowAutoRepeat = field.NewBool(table, "disallowAutoRepeat") + d.Published = field.NewBool(table, "published") + d.DisplayName = field.NewString(table, "displayName") + d.IsWarpSafe = field.NewBool(table, "isWarpSafe") + d.RangeChance = field.NewBool(table, "rangeChance") + d.ElectronicChance = field.NewBool(table, "electronicChance") + d.PropulsionChance = field.NewBool(table, "propulsionChance") + d.Distribution = field.NewInt32(table, "distribution") + d.SfxName = field.NewString(table, "sfxName") + d.NpcUsageChanceAttributeID = field.NewInt32(table, "npcUsageChanceAttributeID") + d.NpcActivationChanceAttributeID = field.NewInt32(table, "npcActivationChanceAttributeID") + d.FittingUsageChanceAttributeID = field.NewInt32(table, "fittingUsageChanceAttributeID") + d.ModifierInfo = field.NewString(table, "modifierInfo") + + d.fillFieldMap() + + return d +} + +func (d *dgmEffect) WithContext(ctx context.Context) *dgmEffectDo { + return d.dgmEffectDo.WithContext(ctx) +} + +func (d dgmEffect) TableName() string { return d.dgmEffectDo.TableName() } + +func (d dgmEffect) Alias() string { return d.dgmEffectDo.Alias() } + +func (d dgmEffect) Columns(cols ...field.Expr) gen.Columns { return d.dgmEffectDo.Columns(cols...) } + +func (d *dgmEffect) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmEffect) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 28) + d.fieldMap["effectID"] = d.EffectID + d.fieldMap["effectName"] = d.EffectName + d.fieldMap["effectCategory"] = d.EffectCategory + d.fieldMap["preExpression"] = d.PreExpression + d.fieldMap["postExpression"] = d.PostExpression + d.fieldMap["description"] = d.Description + d.fieldMap["guid"] = d.GUID + d.fieldMap["iconID"] = d.IconID + d.fieldMap["isOffensive"] = d.IsOffensive + d.fieldMap["isAssistance"] = d.IsAssistance + d.fieldMap["durationAttributeID"] = d.DurationAttributeID + d.fieldMap["trackingSpeedAttributeID"] = d.TrackingSpeedAttributeID + d.fieldMap["dischargeAttributeID"] = d.DischargeAttributeID + d.fieldMap["rangeAttributeID"] = d.RangeAttributeID + d.fieldMap["falloffAttributeID"] = d.FalloffAttributeID + d.fieldMap["disallowAutoRepeat"] = d.DisallowAutoRepeat + d.fieldMap["published"] = d.Published + d.fieldMap["displayName"] = d.DisplayName + d.fieldMap["isWarpSafe"] = d.IsWarpSafe + d.fieldMap["rangeChance"] = d.RangeChance + d.fieldMap["electronicChance"] = d.ElectronicChance + d.fieldMap["propulsionChance"] = d.PropulsionChance + d.fieldMap["distribution"] = d.Distribution + d.fieldMap["sfxName"] = d.SfxName + d.fieldMap["npcUsageChanceAttributeID"] = d.NpcUsageChanceAttributeID + d.fieldMap["npcActivationChanceAttributeID"] = d.NpcActivationChanceAttributeID + d.fieldMap["fittingUsageChanceAttributeID"] = d.FittingUsageChanceAttributeID + d.fieldMap["modifierInfo"] = d.ModifierInfo +} + +func (d dgmEffect) clone(db *gorm.DB) dgmEffect { + d.dgmEffectDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmEffect) replaceDB(db *gorm.DB) dgmEffect { + d.dgmEffectDo.ReplaceDB(db) + return d +} + +type dgmEffectDo struct{ gen.DO } + +func (d dgmEffectDo) Debug() *dgmEffectDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmEffectDo) WithContext(ctx context.Context) *dgmEffectDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmEffectDo) ReadDB() *dgmEffectDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmEffectDo) WriteDB() *dgmEffectDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmEffectDo) Session(config *gorm.Session) *dgmEffectDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmEffectDo) Clauses(conds ...clause.Expression) *dgmEffectDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmEffectDo) Returning(value interface{}, columns ...string) *dgmEffectDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmEffectDo) Not(conds ...gen.Condition) *dgmEffectDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmEffectDo) Or(conds ...gen.Condition) *dgmEffectDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmEffectDo) Select(conds ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmEffectDo) Where(conds ...gen.Condition) *dgmEffectDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmEffectDo) Order(conds ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmEffectDo) Distinct(cols ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmEffectDo) Omit(cols ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmEffectDo) Join(table schema.Tabler, on ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmEffectDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmEffectDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmEffectDo) Group(cols ...field.Expr) *dgmEffectDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmEffectDo) Having(conds ...gen.Condition) *dgmEffectDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmEffectDo) Limit(limit int) *dgmEffectDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmEffectDo) Offset(offset int) *dgmEffectDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmEffectDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmEffectDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmEffectDo) Unscoped() *dgmEffectDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmEffectDo) Create(values ...*models.DgmEffect) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmEffectDo) CreateInBatches(values []*models.DgmEffect, batchSize int) error { + return d.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 (d dgmEffectDo) Save(values ...*models.DgmEffect) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmEffectDo) First() (*models.DgmEffect, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmEffect), nil + } +} + +func (d dgmEffectDo) Take() (*models.DgmEffect, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmEffect), nil + } +} + +func (d dgmEffectDo) Last() (*models.DgmEffect, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmEffect), nil + } +} + +func (d dgmEffectDo) Find() ([]*models.DgmEffect, error) { + result, err := d.DO.Find() + return result.([]*models.DgmEffect), err +} + +func (d dgmEffectDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmEffect, err error) { + buf := make([]*models.DgmEffect, 0, batchSize) + err = d.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 (d dgmEffectDo) FindInBatches(result *[]*models.DgmEffect, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmEffectDo) Attrs(attrs ...field.AssignExpr) *dgmEffectDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmEffectDo) Assign(attrs ...field.AssignExpr) *dgmEffectDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmEffectDo) Joins(fields ...field.RelationField) *dgmEffectDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmEffectDo) Preload(fields ...field.RelationField) *dgmEffectDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmEffectDo) FirstOrInit() (*models.DgmEffect, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmEffect), nil + } +} + +func (d dgmEffectDo) FirstOrCreate() (*models.DgmEffect, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmEffect), nil + } +} + +func (d dgmEffectDo) FindByPage(offset int, limit int) (result []*models.DgmEffect, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmEffectDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmEffectDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmEffectDo) Delete(models ...*models.DgmEffect) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmEffectDo) withDO(do gen.Dao) *dgmEffectDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/dgmexpressions.gen.go b/models/dgmexpressions.gen.go new file mode 100644 index 0000000..b91d9fc --- /dev/null +++ b/models/dgmexpressions.gen.go @@ -0,0 +1,367 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmExpression(db *gorm.DB, opts ...gen.DOOption) dgmExpression { + _dgmExpression := dgmExpression{} + + _dgmExpression.dgmExpressionDo.UseDB(db, opts...) + _dgmExpression.dgmExpressionDo.UseModel(&models.DgmExpression{}) + + tableName := _dgmExpression.dgmExpressionDo.TableName() + _dgmExpression.ALL = field.NewAsterisk(tableName) + _dgmExpression.ExpressionID = field.NewInt32(tableName, "expressionID") + _dgmExpression.OperandID = field.NewInt32(tableName, "operandID") + _dgmExpression.Arg1 = field.NewInt32(tableName, "arg1") + _dgmExpression.Arg2 = field.NewInt32(tableName, "arg2") + _dgmExpression.ExpressionValue = field.NewString(tableName, "expressionValue") + _dgmExpression.Description = field.NewString(tableName, "description") + _dgmExpression.ExpressionName = field.NewString(tableName, "expressionName") + _dgmExpression.ExpressionTypeID = field.NewInt32(tableName, "expressionTypeID") + _dgmExpression.ExpressionGroupID = field.NewInt32(tableName, "expressionGroupID") + _dgmExpression.ExpressionAttributeID = field.NewInt32(tableName, "expressionAttributeID") + + _dgmExpression.fillFieldMap() + + return _dgmExpression +} + +type dgmExpression struct { + dgmExpressionDo dgmExpressionDo + + ALL field.Asterisk + ExpressionID field.Int32 + OperandID field.Int32 + Arg1 field.Int32 + Arg2 field.Int32 + ExpressionValue field.String + Description field.String + ExpressionName field.String + ExpressionTypeID field.Int32 + ExpressionGroupID field.Int32 + ExpressionAttributeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (d dgmExpression) Table(newTableName string) *dgmExpression { + d.dgmExpressionDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmExpression) As(alias string) *dgmExpression { + d.dgmExpressionDo.DO = *(d.dgmExpressionDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmExpression) updateTableName(table string) *dgmExpression { + d.ALL = field.NewAsterisk(table) + d.ExpressionID = field.NewInt32(table, "expressionID") + d.OperandID = field.NewInt32(table, "operandID") + d.Arg1 = field.NewInt32(table, "arg1") + d.Arg2 = field.NewInt32(table, "arg2") + d.ExpressionValue = field.NewString(table, "expressionValue") + d.Description = field.NewString(table, "description") + d.ExpressionName = field.NewString(table, "expressionName") + d.ExpressionTypeID = field.NewInt32(table, "expressionTypeID") + d.ExpressionGroupID = field.NewInt32(table, "expressionGroupID") + d.ExpressionAttributeID = field.NewInt32(table, "expressionAttributeID") + + d.fillFieldMap() + + return d +} + +func (d *dgmExpression) WithContext(ctx context.Context) *dgmExpressionDo { + return d.dgmExpressionDo.WithContext(ctx) +} + +func (d dgmExpression) TableName() string { return d.dgmExpressionDo.TableName() } + +func (d dgmExpression) Alias() string { return d.dgmExpressionDo.Alias() } + +func (d dgmExpression) Columns(cols ...field.Expr) gen.Columns { + return d.dgmExpressionDo.Columns(cols...) +} + +func (d *dgmExpression) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmExpression) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 10) + d.fieldMap["expressionID"] = d.ExpressionID + d.fieldMap["operandID"] = d.OperandID + d.fieldMap["arg1"] = d.Arg1 + d.fieldMap["arg2"] = d.Arg2 + d.fieldMap["expressionValue"] = d.ExpressionValue + d.fieldMap["description"] = d.Description + d.fieldMap["expressionName"] = d.ExpressionName + d.fieldMap["expressionTypeID"] = d.ExpressionTypeID + d.fieldMap["expressionGroupID"] = d.ExpressionGroupID + d.fieldMap["expressionAttributeID"] = d.ExpressionAttributeID +} + +func (d dgmExpression) clone(db *gorm.DB) dgmExpression { + d.dgmExpressionDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmExpression) replaceDB(db *gorm.DB) dgmExpression { + d.dgmExpressionDo.ReplaceDB(db) + return d +} + +type dgmExpressionDo struct{ gen.DO } + +func (d dgmExpressionDo) Debug() *dgmExpressionDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmExpressionDo) WithContext(ctx context.Context) *dgmExpressionDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmExpressionDo) ReadDB() *dgmExpressionDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmExpressionDo) WriteDB() *dgmExpressionDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmExpressionDo) Session(config *gorm.Session) *dgmExpressionDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmExpressionDo) Clauses(conds ...clause.Expression) *dgmExpressionDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmExpressionDo) Returning(value interface{}, columns ...string) *dgmExpressionDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmExpressionDo) Not(conds ...gen.Condition) *dgmExpressionDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmExpressionDo) Or(conds ...gen.Condition) *dgmExpressionDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmExpressionDo) Select(conds ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmExpressionDo) Where(conds ...gen.Condition) *dgmExpressionDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmExpressionDo) Order(conds ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmExpressionDo) Distinct(cols ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmExpressionDo) Omit(cols ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmExpressionDo) Join(table schema.Tabler, on ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmExpressionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmExpressionDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmExpressionDo) Group(cols ...field.Expr) *dgmExpressionDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmExpressionDo) Having(conds ...gen.Condition) *dgmExpressionDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmExpressionDo) Limit(limit int) *dgmExpressionDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmExpressionDo) Offset(offset int) *dgmExpressionDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmExpressionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmExpressionDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmExpressionDo) Unscoped() *dgmExpressionDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmExpressionDo) Create(values ...*models.DgmExpression) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmExpressionDo) CreateInBatches(values []*models.DgmExpression, batchSize int) error { + return d.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 (d dgmExpressionDo) Save(values ...*models.DgmExpression) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmExpressionDo) First() (*models.DgmExpression, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmExpression), nil + } +} + +func (d dgmExpressionDo) Take() (*models.DgmExpression, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmExpression), nil + } +} + +func (d dgmExpressionDo) Last() (*models.DgmExpression, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmExpression), nil + } +} + +func (d dgmExpressionDo) Find() ([]*models.DgmExpression, error) { + result, err := d.DO.Find() + return result.([]*models.DgmExpression), err +} + +func (d dgmExpressionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmExpression, err error) { + buf := make([]*models.DgmExpression, 0, batchSize) + err = d.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 (d dgmExpressionDo) FindInBatches(result *[]*models.DgmExpression, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmExpressionDo) Attrs(attrs ...field.AssignExpr) *dgmExpressionDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmExpressionDo) Assign(attrs ...field.AssignExpr) *dgmExpressionDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmExpressionDo) Joins(fields ...field.RelationField) *dgmExpressionDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmExpressionDo) Preload(fields ...field.RelationField) *dgmExpressionDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmExpressionDo) FirstOrInit() (*models.DgmExpression, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmExpression), nil + } +} + +func (d dgmExpressionDo) FirstOrCreate() (*models.DgmExpression, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmExpression), nil + } +} + +func (d dgmExpressionDo) FindByPage(offset int, limit int) (result []*models.DgmExpression, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmExpressionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmExpressionDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmExpressionDo) Delete(models ...*models.DgmExpression) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmExpressionDo) withDO(do gen.Dao) *dgmExpressionDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/dgmtypeattributes.gen.go b/models/dgmtypeattributes.gen.go new file mode 100644 index 0000000..ae91fda --- /dev/null +++ b/models/dgmtypeattributes.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmTypeAttribute(db *gorm.DB, opts ...gen.DOOption) dgmTypeAttribute { + _dgmTypeAttribute := dgmTypeAttribute{} + + _dgmTypeAttribute.dgmTypeAttributeDo.UseDB(db, opts...) + _dgmTypeAttribute.dgmTypeAttributeDo.UseModel(&models.DgmTypeAttribute{}) + + tableName := _dgmTypeAttribute.dgmTypeAttributeDo.TableName() + _dgmTypeAttribute.ALL = field.NewAsterisk(tableName) + _dgmTypeAttribute.TypeID = field.NewInt32(tableName, "typeID") + _dgmTypeAttribute.AttributeID = field.NewInt32(tableName, "attributeID") + _dgmTypeAttribute.ValueInt = field.NewInt32(tableName, "valueInt") + _dgmTypeAttribute.ValueFloat = field.NewFloat64(tableName, "valueFloat") + + _dgmTypeAttribute.fillFieldMap() + + return _dgmTypeAttribute +} + +type dgmTypeAttribute struct { + dgmTypeAttributeDo dgmTypeAttributeDo + + ALL field.Asterisk + TypeID field.Int32 + AttributeID field.Int32 + ValueInt field.Int32 + ValueFloat field.Float64 + + fieldMap map[string]field.Expr +} + +func (d dgmTypeAttribute) Table(newTableName string) *dgmTypeAttribute { + d.dgmTypeAttributeDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmTypeAttribute) As(alias string) *dgmTypeAttribute { + d.dgmTypeAttributeDo.DO = *(d.dgmTypeAttributeDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmTypeAttribute) updateTableName(table string) *dgmTypeAttribute { + d.ALL = field.NewAsterisk(table) + d.TypeID = field.NewInt32(table, "typeID") + d.AttributeID = field.NewInt32(table, "attributeID") + d.ValueInt = field.NewInt32(table, "valueInt") + d.ValueFloat = field.NewFloat64(table, "valueFloat") + + d.fillFieldMap() + + return d +} + +func (d *dgmTypeAttribute) WithContext(ctx context.Context) *dgmTypeAttributeDo { + return d.dgmTypeAttributeDo.WithContext(ctx) +} + +func (d dgmTypeAttribute) TableName() string { return d.dgmTypeAttributeDo.TableName() } + +func (d dgmTypeAttribute) Alias() string { return d.dgmTypeAttributeDo.Alias() } + +func (d dgmTypeAttribute) Columns(cols ...field.Expr) gen.Columns { + return d.dgmTypeAttributeDo.Columns(cols...) +} + +func (d *dgmTypeAttribute) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmTypeAttribute) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 4) + d.fieldMap["typeID"] = d.TypeID + d.fieldMap["attributeID"] = d.AttributeID + d.fieldMap["valueInt"] = d.ValueInt + d.fieldMap["valueFloat"] = d.ValueFloat +} + +func (d dgmTypeAttribute) clone(db *gorm.DB) dgmTypeAttribute { + d.dgmTypeAttributeDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmTypeAttribute) replaceDB(db *gorm.DB) dgmTypeAttribute { + d.dgmTypeAttributeDo.ReplaceDB(db) + return d +} + +type dgmTypeAttributeDo struct{ gen.DO } + +func (d dgmTypeAttributeDo) Debug() *dgmTypeAttributeDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmTypeAttributeDo) WithContext(ctx context.Context) *dgmTypeAttributeDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmTypeAttributeDo) ReadDB() *dgmTypeAttributeDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmTypeAttributeDo) WriteDB() *dgmTypeAttributeDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmTypeAttributeDo) Session(config *gorm.Session) *dgmTypeAttributeDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmTypeAttributeDo) Clauses(conds ...clause.Expression) *dgmTypeAttributeDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmTypeAttributeDo) Returning(value interface{}, columns ...string) *dgmTypeAttributeDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmTypeAttributeDo) Not(conds ...gen.Condition) *dgmTypeAttributeDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmTypeAttributeDo) Or(conds ...gen.Condition) *dgmTypeAttributeDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmTypeAttributeDo) Select(conds ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmTypeAttributeDo) Where(conds ...gen.Condition) *dgmTypeAttributeDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmTypeAttributeDo) Order(conds ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmTypeAttributeDo) Distinct(cols ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmTypeAttributeDo) Omit(cols ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmTypeAttributeDo) Join(table schema.Tabler, on ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmTypeAttributeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmTypeAttributeDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmTypeAttributeDo) Group(cols ...field.Expr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmTypeAttributeDo) Having(conds ...gen.Condition) *dgmTypeAttributeDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmTypeAttributeDo) Limit(limit int) *dgmTypeAttributeDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmTypeAttributeDo) Offset(offset int) *dgmTypeAttributeDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmTypeAttributeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmTypeAttributeDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmTypeAttributeDo) Unscoped() *dgmTypeAttributeDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmTypeAttributeDo) Create(values ...*models.DgmTypeAttribute) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmTypeAttributeDo) CreateInBatches(values []*models.DgmTypeAttribute, batchSize int) error { + return d.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 (d dgmTypeAttributeDo) Save(values ...*models.DgmTypeAttribute) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmTypeAttributeDo) First() (*models.DgmTypeAttribute, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeAttribute), nil + } +} + +func (d dgmTypeAttributeDo) Take() (*models.DgmTypeAttribute, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeAttribute), nil + } +} + +func (d dgmTypeAttributeDo) Last() (*models.DgmTypeAttribute, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeAttribute), nil + } +} + +func (d dgmTypeAttributeDo) Find() ([]*models.DgmTypeAttribute, error) { + result, err := d.DO.Find() + return result.([]*models.DgmTypeAttribute), err +} + +func (d dgmTypeAttributeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmTypeAttribute, err error) { + buf := make([]*models.DgmTypeAttribute, 0, batchSize) + err = d.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 (d dgmTypeAttributeDo) FindInBatches(result *[]*models.DgmTypeAttribute, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmTypeAttributeDo) Attrs(attrs ...field.AssignExpr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmTypeAttributeDo) Assign(attrs ...field.AssignExpr) *dgmTypeAttributeDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmTypeAttributeDo) Joins(fields ...field.RelationField) *dgmTypeAttributeDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmTypeAttributeDo) Preload(fields ...field.RelationField) *dgmTypeAttributeDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmTypeAttributeDo) FirstOrInit() (*models.DgmTypeAttribute, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeAttribute), nil + } +} + +func (d dgmTypeAttributeDo) FirstOrCreate() (*models.DgmTypeAttribute, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeAttribute), nil + } +} + +func (d dgmTypeAttributeDo) FindByPage(offset int, limit int) (result []*models.DgmTypeAttribute, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmTypeAttributeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmTypeAttributeDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmTypeAttributeDo) Delete(models ...*models.DgmTypeAttribute) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmTypeAttributeDo) withDO(do gen.Dao) *dgmTypeAttributeDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/dgmtypeeffects.gen.go b/models/dgmtypeeffects.gen.go new file mode 100644 index 0000000..eb0bd0e --- /dev/null +++ b/models/dgmtypeeffects.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newDgmTypeEffect(db *gorm.DB, opts ...gen.DOOption) dgmTypeEffect { + _dgmTypeEffect := dgmTypeEffect{} + + _dgmTypeEffect.dgmTypeEffectDo.UseDB(db, opts...) + _dgmTypeEffect.dgmTypeEffectDo.UseModel(&models.DgmTypeEffect{}) + + tableName := _dgmTypeEffect.dgmTypeEffectDo.TableName() + _dgmTypeEffect.ALL = field.NewAsterisk(tableName) + _dgmTypeEffect.TypeID = field.NewInt32(tableName, "typeID") + _dgmTypeEffect.EffectID = field.NewInt32(tableName, "effectID") + _dgmTypeEffect.IsDefault = field.NewBool(tableName, "isDefault") + + _dgmTypeEffect.fillFieldMap() + + return _dgmTypeEffect +} + +type dgmTypeEffect struct { + dgmTypeEffectDo dgmTypeEffectDo + + ALL field.Asterisk + TypeID field.Int32 + EffectID field.Int32 + IsDefault field.Bool + + fieldMap map[string]field.Expr +} + +func (d dgmTypeEffect) Table(newTableName string) *dgmTypeEffect { + d.dgmTypeEffectDo.UseTable(newTableName) + return d.updateTableName(newTableName) +} + +func (d dgmTypeEffect) As(alias string) *dgmTypeEffect { + d.dgmTypeEffectDo.DO = *(d.dgmTypeEffectDo.As(alias).(*gen.DO)) + return d.updateTableName(alias) +} + +func (d *dgmTypeEffect) updateTableName(table string) *dgmTypeEffect { + d.ALL = field.NewAsterisk(table) + d.TypeID = field.NewInt32(table, "typeID") + d.EffectID = field.NewInt32(table, "effectID") + d.IsDefault = field.NewBool(table, "isDefault") + + d.fillFieldMap() + + return d +} + +func (d *dgmTypeEffect) WithContext(ctx context.Context) *dgmTypeEffectDo { + return d.dgmTypeEffectDo.WithContext(ctx) +} + +func (d dgmTypeEffect) TableName() string { return d.dgmTypeEffectDo.TableName() } + +func (d dgmTypeEffect) Alias() string { return d.dgmTypeEffectDo.Alias() } + +func (d dgmTypeEffect) Columns(cols ...field.Expr) gen.Columns { + return d.dgmTypeEffectDo.Columns(cols...) +} + +func (d *dgmTypeEffect) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := d.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (d *dgmTypeEffect) fillFieldMap() { + d.fieldMap = make(map[string]field.Expr, 3) + d.fieldMap["typeID"] = d.TypeID + d.fieldMap["effectID"] = d.EffectID + d.fieldMap["isDefault"] = d.IsDefault +} + +func (d dgmTypeEffect) clone(db *gorm.DB) dgmTypeEffect { + d.dgmTypeEffectDo.ReplaceConnPool(db.Statement.ConnPool) + return d +} + +func (d dgmTypeEffect) replaceDB(db *gorm.DB) dgmTypeEffect { + d.dgmTypeEffectDo.ReplaceDB(db) + return d +} + +type dgmTypeEffectDo struct{ gen.DO } + +func (d dgmTypeEffectDo) Debug() *dgmTypeEffectDo { + return d.withDO(d.DO.Debug()) +} + +func (d dgmTypeEffectDo) WithContext(ctx context.Context) *dgmTypeEffectDo { + return d.withDO(d.DO.WithContext(ctx)) +} + +func (d dgmTypeEffectDo) ReadDB() *dgmTypeEffectDo { + return d.Clauses(dbresolver.Read) +} + +func (d dgmTypeEffectDo) WriteDB() *dgmTypeEffectDo { + return d.Clauses(dbresolver.Write) +} + +func (d dgmTypeEffectDo) Session(config *gorm.Session) *dgmTypeEffectDo { + return d.withDO(d.DO.Session(config)) +} + +func (d dgmTypeEffectDo) Clauses(conds ...clause.Expression) *dgmTypeEffectDo { + return d.withDO(d.DO.Clauses(conds...)) +} + +func (d dgmTypeEffectDo) Returning(value interface{}, columns ...string) *dgmTypeEffectDo { + return d.withDO(d.DO.Returning(value, columns...)) +} + +func (d dgmTypeEffectDo) Not(conds ...gen.Condition) *dgmTypeEffectDo { + return d.withDO(d.DO.Not(conds...)) +} + +func (d dgmTypeEffectDo) Or(conds ...gen.Condition) *dgmTypeEffectDo { + return d.withDO(d.DO.Or(conds...)) +} + +func (d dgmTypeEffectDo) Select(conds ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Select(conds...)) +} + +func (d dgmTypeEffectDo) Where(conds ...gen.Condition) *dgmTypeEffectDo { + return d.withDO(d.DO.Where(conds...)) +} + +func (d dgmTypeEffectDo) Order(conds ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Order(conds...)) +} + +func (d dgmTypeEffectDo) Distinct(cols ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Distinct(cols...)) +} + +func (d dgmTypeEffectDo) Omit(cols ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Omit(cols...)) +} + +func (d dgmTypeEffectDo) Join(table schema.Tabler, on ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Join(table, on...)) +} + +func (d dgmTypeEffectDo) LeftJoin(table schema.Tabler, on ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.LeftJoin(table, on...)) +} + +func (d dgmTypeEffectDo) RightJoin(table schema.Tabler, on ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.RightJoin(table, on...)) +} + +func (d dgmTypeEffectDo) Group(cols ...field.Expr) *dgmTypeEffectDo { + return d.withDO(d.DO.Group(cols...)) +} + +func (d dgmTypeEffectDo) Having(conds ...gen.Condition) *dgmTypeEffectDo { + return d.withDO(d.DO.Having(conds...)) +} + +func (d dgmTypeEffectDo) Limit(limit int) *dgmTypeEffectDo { + return d.withDO(d.DO.Limit(limit)) +} + +func (d dgmTypeEffectDo) Offset(offset int) *dgmTypeEffectDo { + return d.withDO(d.DO.Offset(offset)) +} + +func (d dgmTypeEffectDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *dgmTypeEffectDo { + return d.withDO(d.DO.Scopes(funcs...)) +} + +func (d dgmTypeEffectDo) Unscoped() *dgmTypeEffectDo { + return d.withDO(d.DO.Unscoped()) +} + +func (d dgmTypeEffectDo) Create(values ...*models.DgmTypeEffect) error { + if len(values) == 0 { + return nil + } + return d.DO.Create(values) +} + +func (d dgmTypeEffectDo) CreateInBatches(values []*models.DgmTypeEffect, batchSize int) error { + return d.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 (d dgmTypeEffectDo) Save(values ...*models.DgmTypeEffect) error { + if len(values) == 0 { + return nil + } + return d.DO.Save(values) +} + +func (d dgmTypeEffectDo) First() (*models.DgmTypeEffect, error) { + if result, err := d.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeEffect), nil + } +} + +func (d dgmTypeEffectDo) Take() (*models.DgmTypeEffect, error) { + if result, err := d.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeEffect), nil + } +} + +func (d dgmTypeEffectDo) Last() (*models.DgmTypeEffect, error) { + if result, err := d.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeEffect), nil + } +} + +func (d dgmTypeEffectDo) Find() ([]*models.DgmTypeEffect, error) { + result, err := d.DO.Find() + return result.([]*models.DgmTypeEffect), err +} + +func (d dgmTypeEffectDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.DgmTypeEffect, err error) { + buf := make([]*models.DgmTypeEffect, 0, batchSize) + err = d.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 (d dgmTypeEffectDo) FindInBatches(result *[]*models.DgmTypeEffect, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return d.DO.FindInBatches(result, batchSize, fc) +} + +func (d dgmTypeEffectDo) Attrs(attrs ...field.AssignExpr) *dgmTypeEffectDo { + return d.withDO(d.DO.Attrs(attrs...)) +} + +func (d dgmTypeEffectDo) Assign(attrs ...field.AssignExpr) *dgmTypeEffectDo { + return d.withDO(d.DO.Assign(attrs...)) +} + +func (d dgmTypeEffectDo) Joins(fields ...field.RelationField) *dgmTypeEffectDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Joins(_f)) + } + return &d +} + +func (d dgmTypeEffectDo) Preload(fields ...field.RelationField) *dgmTypeEffectDo { + for _, _f := range fields { + d = *d.withDO(d.DO.Preload(_f)) + } + return &d +} + +func (d dgmTypeEffectDo) FirstOrInit() (*models.DgmTypeEffect, error) { + if result, err := d.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeEffect), nil + } +} + +func (d dgmTypeEffectDo) FirstOrCreate() (*models.DgmTypeEffect, error) { + if result, err := d.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.DgmTypeEffect), nil + } +} + +func (d dgmTypeEffectDo) FindByPage(offset int, limit int) (result []*models.DgmTypeEffect, count int64, err error) { + result, err = d.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 = d.Offset(-1).Limit(-1).Count() + return +} + +func (d dgmTypeEffectDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = d.Count() + if err != nil { + return + } + + err = d.Offset(offset).Limit(limit).Scan(result) + return +} + +func (d dgmTypeEffectDo) Scan(result interface{}) (err error) { + return d.DO.Scan(result) +} + +func (d dgmTypeEffectDo) Delete(models ...*models.DgmTypeEffect) (result gen.ResultInfo, err error) { + return d.DO.Delete(models) +} + +func (d *dgmTypeEffectDo) withDO(do gen.Dao) *dgmTypeEffectDo { + d.DO = *do.(*gen.DO) + return d +} diff --git a/models/evegraphics.gen.go b/models/evegraphics.gen.go new file mode 100644 index 0000000..69e1144 --- /dev/null +++ b/models/evegraphics.gen.go @@ -0,0 +1,349 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newEveGraphic(db *gorm.DB, opts ...gen.DOOption) eveGraphic { + _eveGraphic := eveGraphic{} + + _eveGraphic.eveGraphicDo.UseDB(db, opts...) + _eveGraphic.eveGraphicDo.UseModel(&models.EveGraphic{}) + + tableName := _eveGraphic.eveGraphicDo.TableName() + _eveGraphic.ALL = field.NewAsterisk(tableName) + _eveGraphic.GraphicID = field.NewInt32(tableName, "graphicID") + _eveGraphic.SofFactionName = field.NewString(tableName, "sofFactionName") + _eveGraphic.GraphicFile = field.NewString(tableName, "graphicFile") + _eveGraphic.SofHullName = field.NewString(tableName, "sofHullName") + _eveGraphic.SofRaceName = field.NewString(tableName, "sofRaceName") + _eveGraphic.Description = field.NewString(tableName, "description") + + _eveGraphic.fillFieldMap() + + return _eveGraphic +} + +type eveGraphic struct { + eveGraphicDo eveGraphicDo + + ALL field.Asterisk + GraphicID field.Int32 + SofFactionName field.String + GraphicFile field.String + SofHullName field.String + SofRaceName field.String + Description field.String + + fieldMap map[string]field.Expr +} + +func (e eveGraphic) Table(newTableName string) *eveGraphic { + e.eveGraphicDo.UseTable(newTableName) + return e.updateTableName(newTableName) +} + +func (e eveGraphic) As(alias string) *eveGraphic { + e.eveGraphicDo.DO = *(e.eveGraphicDo.As(alias).(*gen.DO)) + return e.updateTableName(alias) +} + +func (e *eveGraphic) updateTableName(table string) *eveGraphic { + e.ALL = field.NewAsterisk(table) + e.GraphicID = field.NewInt32(table, "graphicID") + e.SofFactionName = field.NewString(table, "sofFactionName") + e.GraphicFile = field.NewString(table, "graphicFile") + e.SofHullName = field.NewString(table, "sofHullName") + e.SofRaceName = field.NewString(table, "sofRaceName") + e.Description = field.NewString(table, "description") + + e.fillFieldMap() + + return e +} + +func (e *eveGraphic) WithContext(ctx context.Context) *eveGraphicDo { + return e.eveGraphicDo.WithContext(ctx) +} + +func (e eveGraphic) TableName() string { return e.eveGraphicDo.TableName() } + +func (e eveGraphic) Alias() string { return e.eveGraphicDo.Alias() } + +func (e eveGraphic) Columns(cols ...field.Expr) gen.Columns { return e.eveGraphicDo.Columns(cols...) } + +func (e *eveGraphic) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := e.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (e *eveGraphic) fillFieldMap() { + e.fieldMap = make(map[string]field.Expr, 6) + e.fieldMap["graphicID"] = e.GraphicID + e.fieldMap["sofFactionName"] = e.SofFactionName + e.fieldMap["graphicFile"] = e.GraphicFile + e.fieldMap["sofHullName"] = e.SofHullName + e.fieldMap["sofRaceName"] = e.SofRaceName + e.fieldMap["description"] = e.Description +} + +func (e eveGraphic) clone(db *gorm.DB) eveGraphic { + e.eveGraphicDo.ReplaceConnPool(db.Statement.ConnPool) + return e +} + +func (e eveGraphic) replaceDB(db *gorm.DB) eveGraphic { + e.eveGraphicDo.ReplaceDB(db) + return e +} + +type eveGraphicDo struct{ gen.DO } + +func (e eveGraphicDo) Debug() *eveGraphicDo { + return e.withDO(e.DO.Debug()) +} + +func (e eveGraphicDo) WithContext(ctx context.Context) *eveGraphicDo { + return e.withDO(e.DO.WithContext(ctx)) +} + +func (e eveGraphicDo) ReadDB() *eveGraphicDo { + return e.Clauses(dbresolver.Read) +} + +func (e eveGraphicDo) WriteDB() *eveGraphicDo { + return e.Clauses(dbresolver.Write) +} + +func (e eveGraphicDo) Session(config *gorm.Session) *eveGraphicDo { + return e.withDO(e.DO.Session(config)) +} + +func (e eveGraphicDo) Clauses(conds ...clause.Expression) *eveGraphicDo { + return e.withDO(e.DO.Clauses(conds...)) +} + +func (e eveGraphicDo) Returning(value interface{}, columns ...string) *eveGraphicDo { + return e.withDO(e.DO.Returning(value, columns...)) +} + +func (e eveGraphicDo) Not(conds ...gen.Condition) *eveGraphicDo { + return e.withDO(e.DO.Not(conds...)) +} + +func (e eveGraphicDo) Or(conds ...gen.Condition) *eveGraphicDo { + return e.withDO(e.DO.Or(conds...)) +} + +func (e eveGraphicDo) Select(conds ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Select(conds...)) +} + +func (e eveGraphicDo) Where(conds ...gen.Condition) *eveGraphicDo { + return e.withDO(e.DO.Where(conds...)) +} + +func (e eveGraphicDo) Order(conds ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Order(conds...)) +} + +func (e eveGraphicDo) Distinct(cols ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Distinct(cols...)) +} + +func (e eveGraphicDo) Omit(cols ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Omit(cols...)) +} + +func (e eveGraphicDo) Join(table schema.Tabler, on ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Join(table, on...)) +} + +func (e eveGraphicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.LeftJoin(table, on...)) +} + +func (e eveGraphicDo) RightJoin(table schema.Tabler, on ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.RightJoin(table, on...)) +} + +func (e eveGraphicDo) Group(cols ...field.Expr) *eveGraphicDo { + return e.withDO(e.DO.Group(cols...)) +} + +func (e eveGraphicDo) Having(conds ...gen.Condition) *eveGraphicDo { + return e.withDO(e.DO.Having(conds...)) +} + +func (e eveGraphicDo) Limit(limit int) *eveGraphicDo { + return e.withDO(e.DO.Limit(limit)) +} + +func (e eveGraphicDo) Offset(offset int) *eveGraphicDo { + return e.withDO(e.DO.Offset(offset)) +} + +func (e eveGraphicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *eveGraphicDo { + return e.withDO(e.DO.Scopes(funcs...)) +} + +func (e eveGraphicDo) Unscoped() *eveGraphicDo { + return e.withDO(e.DO.Unscoped()) +} + +func (e eveGraphicDo) Create(values ...*models.EveGraphic) error { + if len(values) == 0 { + return nil + } + return e.DO.Create(values) +} + +func (e eveGraphicDo) CreateInBatches(values []*models.EveGraphic, batchSize int) error { + return e.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 (e eveGraphicDo) Save(values ...*models.EveGraphic) error { + if len(values) == 0 { + return nil + } + return e.DO.Save(values) +} + +func (e eveGraphicDo) First() (*models.EveGraphic, error) { + if result, err := e.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.EveGraphic), nil + } +} + +func (e eveGraphicDo) Take() (*models.EveGraphic, error) { + if result, err := e.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.EveGraphic), nil + } +} + +func (e eveGraphicDo) Last() (*models.EveGraphic, error) { + if result, err := e.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.EveGraphic), nil + } +} + +func (e eveGraphicDo) Find() ([]*models.EveGraphic, error) { + result, err := e.DO.Find() + return result.([]*models.EveGraphic), err +} + +func (e eveGraphicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.EveGraphic, err error) { + buf := make([]*models.EveGraphic, 0, batchSize) + err = e.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 (e eveGraphicDo) FindInBatches(result *[]*models.EveGraphic, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return e.DO.FindInBatches(result, batchSize, fc) +} + +func (e eveGraphicDo) Attrs(attrs ...field.AssignExpr) *eveGraphicDo { + return e.withDO(e.DO.Attrs(attrs...)) +} + +func (e eveGraphicDo) Assign(attrs ...field.AssignExpr) *eveGraphicDo { + return e.withDO(e.DO.Assign(attrs...)) +} + +func (e eveGraphicDo) Joins(fields ...field.RelationField) *eveGraphicDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Joins(_f)) + } + return &e +} + +func (e eveGraphicDo) Preload(fields ...field.RelationField) *eveGraphicDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Preload(_f)) + } + return &e +} + +func (e eveGraphicDo) FirstOrInit() (*models.EveGraphic, error) { + if result, err := e.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.EveGraphic), nil + } +} + +func (e eveGraphicDo) FirstOrCreate() (*models.EveGraphic, error) { + if result, err := e.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.EveGraphic), nil + } +} + +func (e eveGraphicDo) FindByPage(offset int, limit int) (result []*models.EveGraphic, count int64, err error) { + result, err = e.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 = e.Offset(-1).Limit(-1).Count() + return +} + +func (e eveGraphicDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = e.Count() + if err != nil { + return + } + + err = e.Offset(offset).Limit(limit).Scan(result) + return +} + +func (e eveGraphicDo) Scan(result interface{}) (err error) { + return e.DO.Scan(result) +} + +func (e eveGraphicDo) Delete(models ...*models.EveGraphic) (result gen.ResultInfo, err error) { + return e.DO.Delete(models) +} + +func (e *eveGraphicDo) withDO(do gen.Dao) *eveGraphicDo { + e.DO = *do.(*gen.DO) + return e +} diff --git a/models/eveicons.gen.go b/models/eveicons.gen.go new file mode 100644 index 0000000..eaa822e --- /dev/null +++ b/models/eveicons.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newEveIcon(db *gorm.DB, opts ...gen.DOOption) eveIcon { + _eveIcon := eveIcon{} + + _eveIcon.eveIconDo.UseDB(db, opts...) + _eveIcon.eveIconDo.UseModel(&models.EveIcon{}) + + tableName := _eveIcon.eveIconDo.TableName() + _eveIcon.ALL = field.NewAsterisk(tableName) + _eveIcon.IconID = field.NewInt32(tableName, "iconID") + _eveIcon.IconFile = field.NewString(tableName, "iconFile") + _eveIcon.Description = field.NewString(tableName, "description") + + _eveIcon.fillFieldMap() + + return _eveIcon +} + +type eveIcon struct { + eveIconDo eveIconDo + + ALL field.Asterisk + IconID field.Int32 + IconFile field.String + Description field.String + + fieldMap map[string]field.Expr +} + +func (e eveIcon) Table(newTableName string) *eveIcon { + e.eveIconDo.UseTable(newTableName) + return e.updateTableName(newTableName) +} + +func (e eveIcon) As(alias string) *eveIcon { + e.eveIconDo.DO = *(e.eveIconDo.As(alias).(*gen.DO)) + return e.updateTableName(alias) +} + +func (e *eveIcon) updateTableName(table string) *eveIcon { + e.ALL = field.NewAsterisk(table) + e.IconID = field.NewInt32(table, "iconID") + e.IconFile = field.NewString(table, "iconFile") + e.Description = field.NewString(table, "description") + + e.fillFieldMap() + + return e +} + +func (e *eveIcon) WithContext(ctx context.Context) *eveIconDo { return e.eveIconDo.WithContext(ctx) } + +func (e eveIcon) TableName() string { return e.eveIconDo.TableName() } + +func (e eveIcon) Alias() string { return e.eveIconDo.Alias() } + +func (e eveIcon) Columns(cols ...field.Expr) gen.Columns { return e.eveIconDo.Columns(cols...) } + +func (e *eveIcon) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := e.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (e *eveIcon) fillFieldMap() { + e.fieldMap = make(map[string]field.Expr, 3) + e.fieldMap["iconID"] = e.IconID + e.fieldMap["iconFile"] = e.IconFile + e.fieldMap["description"] = e.Description +} + +func (e eveIcon) clone(db *gorm.DB) eveIcon { + e.eveIconDo.ReplaceConnPool(db.Statement.ConnPool) + return e +} + +func (e eveIcon) replaceDB(db *gorm.DB) eveIcon { + e.eveIconDo.ReplaceDB(db) + return e +} + +type eveIconDo struct{ gen.DO } + +func (e eveIconDo) Debug() *eveIconDo { + return e.withDO(e.DO.Debug()) +} + +func (e eveIconDo) WithContext(ctx context.Context) *eveIconDo { + return e.withDO(e.DO.WithContext(ctx)) +} + +func (e eveIconDo) ReadDB() *eveIconDo { + return e.Clauses(dbresolver.Read) +} + +func (e eveIconDo) WriteDB() *eveIconDo { + return e.Clauses(dbresolver.Write) +} + +func (e eveIconDo) Session(config *gorm.Session) *eveIconDo { + return e.withDO(e.DO.Session(config)) +} + +func (e eveIconDo) Clauses(conds ...clause.Expression) *eveIconDo { + return e.withDO(e.DO.Clauses(conds...)) +} + +func (e eveIconDo) Returning(value interface{}, columns ...string) *eveIconDo { + return e.withDO(e.DO.Returning(value, columns...)) +} + +func (e eveIconDo) Not(conds ...gen.Condition) *eveIconDo { + return e.withDO(e.DO.Not(conds...)) +} + +func (e eveIconDo) Or(conds ...gen.Condition) *eveIconDo { + return e.withDO(e.DO.Or(conds...)) +} + +func (e eveIconDo) Select(conds ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Select(conds...)) +} + +func (e eveIconDo) Where(conds ...gen.Condition) *eveIconDo { + return e.withDO(e.DO.Where(conds...)) +} + +func (e eveIconDo) Order(conds ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Order(conds...)) +} + +func (e eveIconDo) Distinct(cols ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Distinct(cols...)) +} + +func (e eveIconDo) Omit(cols ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Omit(cols...)) +} + +func (e eveIconDo) Join(table schema.Tabler, on ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Join(table, on...)) +} + +func (e eveIconDo) LeftJoin(table schema.Tabler, on ...field.Expr) *eveIconDo { + return e.withDO(e.DO.LeftJoin(table, on...)) +} + +func (e eveIconDo) RightJoin(table schema.Tabler, on ...field.Expr) *eveIconDo { + return e.withDO(e.DO.RightJoin(table, on...)) +} + +func (e eveIconDo) Group(cols ...field.Expr) *eveIconDo { + return e.withDO(e.DO.Group(cols...)) +} + +func (e eveIconDo) Having(conds ...gen.Condition) *eveIconDo { + return e.withDO(e.DO.Having(conds...)) +} + +func (e eveIconDo) Limit(limit int) *eveIconDo { + return e.withDO(e.DO.Limit(limit)) +} + +func (e eveIconDo) Offset(offset int) *eveIconDo { + return e.withDO(e.DO.Offset(offset)) +} + +func (e eveIconDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *eveIconDo { + return e.withDO(e.DO.Scopes(funcs...)) +} + +func (e eveIconDo) Unscoped() *eveIconDo { + return e.withDO(e.DO.Unscoped()) +} + +func (e eveIconDo) Create(values ...*models.EveIcon) error { + if len(values) == 0 { + return nil + } + return e.DO.Create(values) +} + +func (e eveIconDo) CreateInBatches(values []*models.EveIcon, batchSize int) error { + return e.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 (e eveIconDo) Save(values ...*models.EveIcon) error { + if len(values) == 0 { + return nil + } + return e.DO.Save(values) +} + +func (e eveIconDo) First() (*models.EveIcon, error) { + if result, err := e.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.EveIcon), nil + } +} + +func (e eveIconDo) Take() (*models.EveIcon, error) { + if result, err := e.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.EveIcon), nil + } +} + +func (e eveIconDo) Last() (*models.EveIcon, error) { + if result, err := e.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.EveIcon), nil + } +} + +func (e eveIconDo) Find() ([]*models.EveIcon, error) { + result, err := e.DO.Find() + return result.([]*models.EveIcon), err +} + +func (e eveIconDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.EveIcon, err error) { + buf := make([]*models.EveIcon, 0, batchSize) + err = e.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 (e eveIconDo) FindInBatches(result *[]*models.EveIcon, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return e.DO.FindInBatches(result, batchSize, fc) +} + +func (e eveIconDo) Attrs(attrs ...field.AssignExpr) *eveIconDo { + return e.withDO(e.DO.Attrs(attrs...)) +} + +func (e eveIconDo) Assign(attrs ...field.AssignExpr) *eveIconDo { + return e.withDO(e.DO.Assign(attrs...)) +} + +func (e eveIconDo) Joins(fields ...field.RelationField) *eveIconDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Joins(_f)) + } + return &e +} + +func (e eveIconDo) Preload(fields ...field.RelationField) *eveIconDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Preload(_f)) + } + return &e +} + +func (e eveIconDo) FirstOrInit() (*models.EveIcon, error) { + if result, err := e.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.EveIcon), nil + } +} + +func (e eveIconDo) FirstOrCreate() (*models.EveIcon, error) { + if result, err := e.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.EveIcon), nil + } +} + +func (e eveIconDo) FindByPage(offset int, limit int) (result []*models.EveIcon, count int64, err error) { + result, err = e.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 = e.Offset(-1).Limit(-1).Count() + return +} + +func (e eveIconDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = e.Count() + if err != nil { + return + } + + err = e.Offset(offset).Limit(limit).Scan(result) + return +} + +func (e eveIconDo) Scan(result interface{}) (err error) { + return e.DO.Scan(result) +} + +func (e eveIconDo) Delete(models ...*models.EveIcon) (result gen.ResultInfo, err error) { + return e.DO.Delete(models) +} + +func (e *eveIconDo) withDO(do gen.Dao) *eveIconDo { + e.DO = *do.(*gen.DO) + return e +} diff --git a/models/eveunits.gen.go b/models/eveunits.gen.go new file mode 100644 index 0000000..f0984fd --- /dev/null +++ b/models/eveunits.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newEveUnit(db *gorm.DB, opts ...gen.DOOption) eveUnit { + _eveUnit := eveUnit{} + + _eveUnit.eveUnitDo.UseDB(db, opts...) + _eveUnit.eveUnitDo.UseModel(&models.EveUnit{}) + + tableName := _eveUnit.eveUnitDo.TableName() + _eveUnit.ALL = field.NewAsterisk(tableName) + _eveUnit.UnitID = field.NewInt32(tableName, "unitID") + _eveUnit.UnitName = field.NewString(tableName, "unitName") + _eveUnit.DisplayName = field.NewString(tableName, "displayName") + _eveUnit.Description = field.NewString(tableName, "description") + + _eveUnit.fillFieldMap() + + return _eveUnit +} + +type eveUnit struct { + eveUnitDo eveUnitDo + + ALL field.Asterisk + UnitID field.Int32 + UnitName field.String + DisplayName field.String + Description field.String + + fieldMap map[string]field.Expr +} + +func (e eveUnit) Table(newTableName string) *eveUnit { + e.eveUnitDo.UseTable(newTableName) + return e.updateTableName(newTableName) +} + +func (e eveUnit) As(alias string) *eveUnit { + e.eveUnitDo.DO = *(e.eveUnitDo.As(alias).(*gen.DO)) + return e.updateTableName(alias) +} + +func (e *eveUnit) updateTableName(table string) *eveUnit { + e.ALL = field.NewAsterisk(table) + e.UnitID = field.NewInt32(table, "unitID") + e.UnitName = field.NewString(table, "unitName") + e.DisplayName = field.NewString(table, "displayName") + e.Description = field.NewString(table, "description") + + e.fillFieldMap() + + return e +} + +func (e *eveUnit) WithContext(ctx context.Context) *eveUnitDo { return e.eveUnitDo.WithContext(ctx) } + +func (e eveUnit) TableName() string { return e.eveUnitDo.TableName() } + +func (e eveUnit) Alias() string { return e.eveUnitDo.Alias() } + +func (e eveUnit) Columns(cols ...field.Expr) gen.Columns { return e.eveUnitDo.Columns(cols...) } + +func (e *eveUnit) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := e.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (e *eveUnit) fillFieldMap() { + e.fieldMap = make(map[string]field.Expr, 4) + e.fieldMap["unitID"] = e.UnitID + e.fieldMap["unitName"] = e.UnitName + e.fieldMap["displayName"] = e.DisplayName + e.fieldMap["description"] = e.Description +} + +func (e eveUnit) clone(db *gorm.DB) eveUnit { + e.eveUnitDo.ReplaceConnPool(db.Statement.ConnPool) + return e +} + +func (e eveUnit) replaceDB(db *gorm.DB) eveUnit { + e.eveUnitDo.ReplaceDB(db) + return e +} + +type eveUnitDo struct{ gen.DO } + +func (e eveUnitDo) Debug() *eveUnitDo { + return e.withDO(e.DO.Debug()) +} + +func (e eveUnitDo) WithContext(ctx context.Context) *eveUnitDo { + return e.withDO(e.DO.WithContext(ctx)) +} + +func (e eveUnitDo) ReadDB() *eveUnitDo { + return e.Clauses(dbresolver.Read) +} + +func (e eveUnitDo) WriteDB() *eveUnitDo { + return e.Clauses(dbresolver.Write) +} + +func (e eveUnitDo) Session(config *gorm.Session) *eveUnitDo { + return e.withDO(e.DO.Session(config)) +} + +func (e eveUnitDo) Clauses(conds ...clause.Expression) *eveUnitDo { + return e.withDO(e.DO.Clauses(conds...)) +} + +func (e eveUnitDo) Returning(value interface{}, columns ...string) *eveUnitDo { + return e.withDO(e.DO.Returning(value, columns...)) +} + +func (e eveUnitDo) Not(conds ...gen.Condition) *eveUnitDo { + return e.withDO(e.DO.Not(conds...)) +} + +func (e eveUnitDo) Or(conds ...gen.Condition) *eveUnitDo { + return e.withDO(e.DO.Or(conds...)) +} + +func (e eveUnitDo) Select(conds ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Select(conds...)) +} + +func (e eveUnitDo) Where(conds ...gen.Condition) *eveUnitDo { + return e.withDO(e.DO.Where(conds...)) +} + +func (e eveUnitDo) Order(conds ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Order(conds...)) +} + +func (e eveUnitDo) Distinct(cols ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Distinct(cols...)) +} + +func (e eveUnitDo) Omit(cols ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Omit(cols...)) +} + +func (e eveUnitDo) Join(table schema.Tabler, on ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Join(table, on...)) +} + +func (e eveUnitDo) LeftJoin(table schema.Tabler, on ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.LeftJoin(table, on...)) +} + +func (e eveUnitDo) RightJoin(table schema.Tabler, on ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.RightJoin(table, on...)) +} + +func (e eveUnitDo) Group(cols ...field.Expr) *eveUnitDo { + return e.withDO(e.DO.Group(cols...)) +} + +func (e eveUnitDo) Having(conds ...gen.Condition) *eveUnitDo { + return e.withDO(e.DO.Having(conds...)) +} + +func (e eveUnitDo) Limit(limit int) *eveUnitDo { + return e.withDO(e.DO.Limit(limit)) +} + +func (e eveUnitDo) Offset(offset int) *eveUnitDo { + return e.withDO(e.DO.Offset(offset)) +} + +func (e eveUnitDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *eveUnitDo { + return e.withDO(e.DO.Scopes(funcs...)) +} + +func (e eveUnitDo) Unscoped() *eveUnitDo { + return e.withDO(e.DO.Unscoped()) +} + +func (e eveUnitDo) Create(values ...*models.EveUnit) error { + if len(values) == 0 { + return nil + } + return e.DO.Create(values) +} + +func (e eveUnitDo) CreateInBatches(values []*models.EveUnit, batchSize int) error { + return e.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 (e eveUnitDo) Save(values ...*models.EveUnit) error { + if len(values) == 0 { + return nil + } + return e.DO.Save(values) +} + +func (e eveUnitDo) First() (*models.EveUnit, error) { + if result, err := e.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.EveUnit), nil + } +} + +func (e eveUnitDo) Take() (*models.EveUnit, error) { + if result, err := e.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.EveUnit), nil + } +} + +func (e eveUnitDo) Last() (*models.EveUnit, error) { + if result, err := e.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.EveUnit), nil + } +} + +func (e eveUnitDo) Find() ([]*models.EveUnit, error) { + result, err := e.DO.Find() + return result.([]*models.EveUnit), err +} + +func (e eveUnitDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.EveUnit, err error) { + buf := make([]*models.EveUnit, 0, batchSize) + err = e.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 (e eveUnitDo) FindInBatches(result *[]*models.EveUnit, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return e.DO.FindInBatches(result, batchSize, fc) +} + +func (e eveUnitDo) Attrs(attrs ...field.AssignExpr) *eveUnitDo { + return e.withDO(e.DO.Attrs(attrs...)) +} + +func (e eveUnitDo) Assign(attrs ...field.AssignExpr) *eveUnitDo { + return e.withDO(e.DO.Assign(attrs...)) +} + +func (e eveUnitDo) Joins(fields ...field.RelationField) *eveUnitDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Joins(_f)) + } + return &e +} + +func (e eveUnitDo) Preload(fields ...field.RelationField) *eveUnitDo { + for _, _f := range fields { + e = *e.withDO(e.DO.Preload(_f)) + } + return &e +} + +func (e eveUnitDo) FirstOrInit() (*models.EveUnit, error) { + if result, err := e.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.EveUnit), nil + } +} + +func (e eveUnitDo) FirstOrCreate() (*models.EveUnit, error) { + if result, err := e.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.EveUnit), nil + } +} + +func (e eveUnitDo) FindByPage(offset int, limit int) (result []*models.EveUnit, count int64, err error) { + result, err = e.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 = e.Offset(-1).Limit(-1).Count() + return +} + +func (e eveUnitDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = e.Count() + if err != nil { + return + } + + err = e.Offset(offset).Limit(limit).Scan(result) + return +} + +func (e eveUnitDo) Scan(result interface{}) (err error) { + return e.DO.Scan(result) +} + +func (e eveUnitDo) Delete(models ...*models.EveUnit) (result gen.ResultInfo, err error) { + return e.DO.Delete(models) +} + +func (e *eveUnitDo) withDO(do gen.Dao) *eveUnitDo { + e.DO = *do.(*gen.DO) + return e +} diff --git a/models/gen.go b/models/gen.go new file mode 100644 index 0000000..448e281 --- /dev/null +++ b/models/gen.go @@ -0,0 +1,627 @@ +// 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 models + +import ( + "context" + "database/sql" + + "gorm.io/gorm" + + "gorm.io/gen" + + "gorm.io/plugin/dbresolver" +) + +func Use(db *gorm.DB, opts ...gen.DOOption) *Query { + return &Query{ + db: db, + AgtAgent: newAgtAgent(db, opts...), + AgtAgentType: newAgtAgentType(db, opts...), + AgtAgentsInSpace: newAgtAgentsInSpace(db, opts...), + AgtResearchAgent: newAgtResearchAgent(db, opts...), + CertCert: newCertCert(db, opts...), + CertMastery: newCertMastery(db, opts...), + CertSkill: newCertSkill(db, opts...), + ChrAncestry: newChrAncestry(db, opts...), + ChrAttribute: newChrAttribute(db, opts...), + ChrBloodline: newChrBloodline(db, opts...), + ChrFaction: newChrFaction(db, opts...), + ChrRace: newChrRace(db, opts...), + CrpActivity: newCrpActivity(db, opts...), + CrpNPCCorporation: newCrpNPCCorporation(db, opts...), + CrpNPCCorporationDivision: newCrpNPCCorporationDivision(db, opts...), + CrpNPCCorporationResearchField: newCrpNPCCorporationResearchField(db, opts...), + CrpNPCCorporationTrade: newCrpNPCCorporationTrade(db, opts...), + CrpNPCDivision: newCrpNPCDivision(db, opts...), + DgmAttributeCategory: newDgmAttributeCategory(db, opts...), + DgmAttributeType: newDgmAttributeType(db, opts...), + DgmEffect: newDgmEffect(db, opts...), + DgmExpression: newDgmExpression(db, opts...), + DgmTypeAttribute: newDgmTypeAttribute(db, opts...), + DgmTypeEffect: newDgmTypeEffect(db, opts...), + EveGraphic: newEveGraphic(db, opts...), + EveIcon: newEveIcon(db, opts...), + EveUnit: newEveUnit(db, opts...), + IndustryActivity: newIndustryActivity(db, opts...), + IndustryActivityMaterial: newIndustryActivityMaterial(db, opts...), + IndustryActivityProbability: newIndustryActivityProbability(db, opts...), + IndustryActivityProduct: newIndustryActivityProduct(db, opts...), + IndustryActivityRace: newIndustryActivityRace(db, opts...), + IndustryActivitySkill: newIndustryActivitySkill(db, opts...), + IndustryBlueprint: newIndustryBlueprint(db, opts...), + InvCategory: newInvCategory(db, opts...), + InvContrabandType: newInvContrabandType(db, opts...), + InvControlTowerResource: newInvControlTowerResource(db, opts...), + InvControlTowerResourcePurpose: newInvControlTowerResourcePurpose(db, opts...), + InvFlag: newInvFlag(db, opts...), + InvGroup: newInvGroup(db, opts...), + InvItem: newInvItem(db, opts...), + InvMarketGroup: newInvMarketGroup(db, opts...), + InvMetaGroup: newInvMetaGroup(db, opts...), + InvMetaType: newInvMetaType(db, opts...), + InvName: newInvName(db, opts...), + InvPosition: newInvPosition(db, opts...), + InvTrait: newInvTrait(db, opts...), + InvType: newInvType(db, opts...), + InvTypeMaterial: newInvTypeMaterial(db, opts...), + InvTypeReaction: newInvTypeReaction(db, opts...), + InvUniqueName: newInvUniqueName(db, opts...), + InvVolume: newInvVolume(db, opts...), + MapCelestialGraphic: newMapCelestialGraphic(db, opts...), + MapCelestialStatistic: newMapCelestialStatistic(db, opts...), + MapConstellation: newMapConstellation(db, opts...), + MapConstellationJump: newMapConstellationJump(db, opts...), + MapDenormalize: newMapDenormalize(db, opts...), + MapJump: newMapJump(db, opts...), + MapLandmark: newMapLandmark(db, opts...), + MapLocationScene: newMapLocationScene(db, opts...), + MapLocationWormholeClass: newMapLocationWormholeClass(db, opts...), + MapRegion: newMapRegion(db, opts...), + MapRegionJump: newMapRegionJump(db, opts...), + MapSolarSystem: newMapSolarSystem(db, opts...), + MapSolarSystemJump: newMapSolarSystemJump(db, opts...), + MapUniverse: newMapUniverse(db, opts...), + PlanetSchematic: newPlanetSchematic(db, opts...), + PlanetSchematicsPinMap: newPlanetSchematicsPinMap(db, opts...), + PlanetSchematicsTypeMap: newPlanetSchematicsTypeMap(db, opts...), + RAMActivity: newRAMActivity(db, opts...), + RAMAssemblyLineStation: newRAMAssemblyLineStation(db, opts...), + RAMAssemblyLineType: newRAMAssemblyLineType(db, opts...), + RAMAssemblyLineTypeDetailPerCategory: newRAMAssemblyLineTypeDetailPerCategory(db, opts...), + RAMAssemblyLineTypeDetailPerGroup: newRAMAssemblyLineTypeDetailPerGroup(db, opts...), + RAMInstallationTypeContent: newRAMInstallationTypeContent(db, opts...), + Skin: newSkin(db, opts...), + SkinLicense: newSkinLicense(db, opts...), + SkinMaterial: newSkinMaterial(db, opts...), + SkinShip: newSkinShip(db, opts...), + StaOperation: newStaOperation(db, opts...), + StaOperationService: newStaOperationService(db, opts...), + StaService: newStaService(db, opts...), + StaStation: newStaStation(db, opts...), + StaStationType: newStaStationType(db, opts...), + TranslationTable: newTranslationTable(db, opts...), + TrnTranslation: newTrnTranslation(db, opts...), + TrnTranslationColumn: newTrnTranslationColumn(db, opts...), + TrnTranslationLanguage: newTrnTranslationLanguage(db, opts...), + WarCombatZone: newWarCombatZone(db, opts...), + WarCombatZoneSystem: newWarCombatZoneSystem(db, opts...), + } +} + +type Query struct { + db *gorm.DB + + AgtAgent agtAgent + AgtAgentType agtAgentType + AgtAgentsInSpace agtAgentsInSpace + AgtResearchAgent agtResearchAgent + CertCert certCert + CertMastery certMastery + CertSkill certSkill + ChrAncestry chrAncestry + ChrAttribute chrAttribute + ChrBloodline chrBloodline + ChrFaction chrFaction + ChrRace chrRace + CrpActivity crpActivity + CrpNPCCorporation crpNPCCorporation + CrpNPCCorporationDivision crpNPCCorporationDivision + CrpNPCCorporationResearchField crpNPCCorporationResearchField + CrpNPCCorporationTrade crpNPCCorporationTrade + CrpNPCDivision crpNPCDivision + DgmAttributeCategory dgmAttributeCategory + DgmAttributeType dgmAttributeType + DgmEffect dgmEffect + DgmExpression dgmExpression + DgmTypeAttribute dgmTypeAttribute + DgmTypeEffect dgmTypeEffect + EveGraphic eveGraphic + EveIcon eveIcon + EveUnit eveUnit + IndustryActivity industryActivity + IndustryActivityMaterial industryActivityMaterial + IndustryActivityProbability industryActivityProbability + IndustryActivityProduct industryActivityProduct + IndustryActivityRace industryActivityRace + IndustryActivitySkill industryActivitySkill + IndustryBlueprint industryBlueprint + InvCategory invCategory + InvContrabandType invContrabandType + InvControlTowerResource invControlTowerResource + InvControlTowerResourcePurpose invControlTowerResourcePurpose + InvFlag invFlag + InvGroup invGroup + InvItem invItem + InvMarketGroup invMarketGroup + InvMetaGroup invMetaGroup + InvMetaType invMetaType + InvName invName + InvPosition invPosition + InvTrait invTrait + InvType invType + InvTypeMaterial invTypeMaterial + InvTypeReaction invTypeReaction + InvUniqueName invUniqueName + InvVolume invVolume + MapCelestialGraphic mapCelestialGraphic + MapCelestialStatistic mapCelestialStatistic + MapConstellation mapConstellation + MapConstellationJump mapConstellationJump + MapDenormalize mapDenormalize + MapJump mapJump + MapLandmark mapLandmark + MapLocationScene mapLocationScene + MapLocationWormholeClass mapLocationWormholeClass + MapRegion mapRegion + MapRegionJump mapRegionJump + MapSolarSystem mapSolarSystem + MapSolarSystemJump mapSolarSystemJump + MapUniverse mapUniverse + PlanetSchematic planetSchematic + PlanetSchematicsPinMap planetSchematicsPinMap + PlanetSchematicsTypeMap planetSchematicsTypeMap + RAMActivity rAMActivity + RAMAssemblyLineStation rAMAssemblyLineStation + RAMAssemblyLineType rAMAssemblyLineType + RAMAssemblyLineTypeDetailPerCategory rAMAssemblyLineTypeDetailPerCategory + RAMAssemblyLineTypeDetailPerGroup rAMAssemblyLineTypeDetailPerGroup + RAMInstallationTypeContent rAMInstallationTypeContent + Skin skin + SkinLicense skinLicense + SkinMaterial skinMaterial + SkinShip skinShip + StaOperation staOperation + StaOperationService staOperationService + StaService staService + StaStation staStation + StaStationType staStationType + TranslationTable translationTable + TrnTranslation trnTranslation + TrnTranslationColumn trnTranslationColumn + TrnTranslationLanguage trnTranslationLanguage + WarCombatZone warCombatZone + WarCombatZoneSystem warCombatZoneSystem +} + +func (q *Query) Available() bool { return q.db != nil } + +func (q *Query) clone(db *gorm.DB) *Query { + return &Query{ + db: db, + AgtAgent: q.AgtAgent.clone(db), + AgtAgentType: q.AgtAgentType.clone(db), + AgtAgentsInSpace: q.AgtAgentsInSpace.clone(db), + AgtResearchAgent: q.AgtResearchAgent.clone(db), + CertCert: q.CertCert.clone(db), + CertMastery: q.CertMastery.clone(db), + CertSkill: q.CertSkill.clone(db), + ChrAncestry: q.ChrAncestry.clone(db), + ChrAttribute: q.ChrAttribute.clone(db), + ChrBloodline: q.ChrBloodline.clone(db), + ChrFaction: q.ChrFaction.clone(db), + ChrRace: q.ChrRace.clone(db), + CrpActivity: q.CrpActivity.clone(db), + CrpNPCCorporation: q.CrpNPCCorporation.clone(db), + CrpNPCCorporationDivision: q.CrpNPCCorporationDivision.clone(db), + CrpNPCCorporationResearchField: q.CrpNPCCorporationResearchField.clone(db), + CrpNPCCorporationTrade: q.CrpNPCCorporationTrade.clone(db), + CrpNPCDivision: q.CrpNPCDivision.clone(db), + DgmAttributeCategory: q.DgmAttributeCategory.clone(db), + DgmAttributeType: q.DgmAttributeType.clone(db), + DgmEffect: q.DgmEffect.clone(db), + DgmExpression: q.DgmExpression.clone(db), + DgmTypeAttribute: q.DgmTypeAttribute.clone(db), + DgmTypeEffect: q.DgmTypeEffect.clone(db), + EveGraphic: q.EveGraphic.clone(db), + EveIcon: q.EveIcon.clone(db), + EveUnit: q.EveUnit.clone(db), + IndustryActivity: q.IndustryActivity.clone(db), + IndustryActivityMaterial: q.IndustryActivityMaterial.clone(db), + IndustryActivityProbability: q.IndustryActivityProbability.clone(db), + IndustryActivityProduct: q.IndustryActivityProduct.clone(db), + IndustryActivityRace: q.IndustryActivityRace.clone(db), + IndustryActivitySkill: q.IndustryActivitySkill.clone(db), + IndustryBlueprint: q.IndustryBlueprint.clone(db), + InvCategory: q.InvCategory.clone(db), + InvContrabandType: q.InvContrabandType.clone(db), + InvControlTowerResource: q.InvControlTowerResource.clone(db), + InvControlTowerResourcePurpose: q.InvControlTowerResourcePurpose.clone(db), + InvFlag: q.InvFlag.clone(db), + InvGroup: q.InvGroup.clone(db), + InvItem: q.InvItem.clone(db), + InvMarketGroup: q.InvMarketGroup.clone(db), + InvMetaGroup: q.InvMetaGroup.clone(db), + InvMetaType: q.InvMetaType.clone(db), + InvName: q.InvName.clone(db), + InvPosition: q.InvPosition.clone(db), + InvTrait: q.InvTrait.clone(db), + InvType: q.InvType.clone(db), + InvTypeMaterial: q.InvTypeMaterial.clone(db), + InvTypeReaction: q.InvTypeReaction.clone(db), + InvUniqueName: q.InvUniqueName.clone(db), + InvVolume: q.InvVolume.clone(db), + MapCelestialGraphic: q.MapCelestialGraphic.clone(db), + MapCelestialStatistic: q.MapCelestialStatistic.clone(db), + MapConstellation: q.MapConstellation.clone(db), + MapConstellationJump: q.MapConstellationJump.clone(db), + MapDenormalize: q.MapDenormalize.clone(db), + MapJump: q.MapJump.clone(db), + MapLandmark: q.MapLandmark.clone(db), + MapLocationScene: q.MapLocationScene.clone(db), + MapLocationWormholeClass: q.MapLocationWormholeClass.clone(db), + MapRegion: q.MapRegion.clone(db), + MapRegionJump: q.MapRegionJump.clone(db), + MapSolarSystem: q.MapSolarSystem.clone(db), + MapSolarSystemJump: q.MapSolarSystemJump.clone(db), + MapUniverse: q.MapUniverse.clone(db), + PlanetSchematic: q.PlanetSchematic.clone(db), + PlanetSchematicsPinMap: q.PlanetSchematicsPinMap.clone(db), + PlanetSchematicsTypeMap: q.PlanetSchematicsTypeMap.clone(db), + RAMActivity: q.RAMActivity.clone(db), + RAMAssemblyLineStation: q.RAMAssemblyLineStation.clone(db), + RAMAssemblyLineType: q.RAMAssemblyLineType.clone(db), + RAMAssemblyLineTypeDetailPerCategory: q.RAMAssemblyLineTypeDetailPerCategory.clone(db), + RAMAssemblyLineTypeDetailPerGroup: q.RAMAssemblyLineTypeDetailPerGroup.clone(db), + RAMInstallationTypeContent: q.RAMInstallationTypeContent.clone(db), + Skin: q.Skin.clone(db), + SkinLicense: q.SkinLicense.clone(db), + SkinMaterial: q.SkinMaterial.clone(db), + SkinShip: q.SkinShip.clone(db), + StaOperation: q.StaOperation.clone(db), + StaOperationService: q.StaOperationService.clone(db), + StaService: q.StaService.clone(db), + StaStation: q.StaStation.clone(db), + StaStationType: q.StaStationType.clone(db), + TranslationTable: q.TranslationTable.clone(db), + TrnTranslation: q.TrnTranslation.clone(db), + TrnTranslationColumn: q.TrnTranslationColumn.clone(db), + TrnTranslationLanguage: q.TrnTranslationLanguage.clone(db), + WarCombatZone: q.WarCombatZone.clone(db), + WarCombatZoneSystem: q.WarCombatZoneSystem.clone(db), + } +} + +func (q *Query) ReadDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Read)) +} + +func (q *Query) WriteDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Write)) +} + +func (q *Query) ReplaceDB(db *gorm.DB) *Query { + return &Query{ + db: db, + AgtAgent: q.AgtAgent.replaceDB(db), + AgtAgentType: q.AgtAgentType.replaceDB(db), + AgtAgentsInSpace: q.AgtAgentsInSpace.replaceDB(db), + AgtResearchAgent: q.AgtResearchAgent.replaceDB(db), + CertCert: q.CertCert.replaceDB(db), + CertMastery: q.CertMastery.replaceDB(db), + CertSkill: q.CertSkill.replaceDB(db), + ChrAncestry: q.ChrAncestry.replaceDB(db), + ChrAttribute: q.ChrAttribute.replaceDB(db), + ChrBloodline: q.ChrBloodline.replaceDB(db), + ChrFaction: q.ChrFaction.replaceDB(db), + ChrRace: q.ChrRace.replaceDB(db), + CrpActivity: q.CrpActivity.replaceDB(db), + CrpNPCCorporation: q.CrpNPCCorporation.replaceDB(db), + CrpNPCCorporationDivision: q.CrpNPCCorporationDivision.replaceDB(db), + CrpNPCCorporationResearchField: q.CrpNPCCorporationResearchField.replaceDB(db), + CrpNPCCorporationTrade: q.CrpNPCCorporationTrade.replaceDB(db), + CrpNPCDivision: q.CrpNPCDivision.replaceDB(db), + DgmAttributeCategory: q.DgmAttributeCategory.replaceDB(db), + DgmAttributeType: q.DgmAttributeType.replaceDB(db), + DgmEffect: q.DgmEffect.replaceDB(db), + DgmExpression: q.DgmExpression.replaceDB(db), + DgmTypeAttribute: q.DgmTypeAttribute.replaceDB(db), + DgmTypeEffect: q.DgmTypeEffect.replaceDB(db), + EveGraphic: q.EveGraphic.replaceDB(db), + EveIcon: q.EveIcon.replaceDB(db), + EveUnit: q.EveUnit.replaceDB(db), + IndustryActivity: q.IndustryActivity.replaceDB(db), + IndustryActivityMaterial: q.IndustryActivityMaterial.replaceDB(db), + IndustryActivityProbability: q.IndustryActivityProbability.replaceDB(db), + IndustryActivityProduct: q.IndustryActivityProduct.replaceDB(db), + IndustryActivityRace: q.IndustryActivityRace.replaceDB(db), + IndustryActivitySkill: q.IndustryActivitySkill.replaceDB(db), + IndustryBlueprint: q.IndustryBlueprint.replaceDB(db), + InvCategory: q.InvCategory.replaceDB(db), + InvContrabandType: q.InvContrabandType.replaceDB(db), + InvControlTowerResource: q.InvControlTowerResource.replaceDB(db), + InvControlTowerResourcePurpose: q.InvControlTowerResourcePurpose.replaceDB(db), + InvFlag: q.InvFlag.replaceDB(db), + InvGroup: q.InvGroup.replaceDB(db), + InvItem: q.InvItem.replaceDB(db), + InvMarketGroup: q.InvMarketGroup.replaceDB(db), + InvMetaGroup: q.InvMetaGroup.replaceDB(db), + InvMetaType: q.InvMetaType.replaceDB(db), + InvName: q.InvName.replaceDB(db), + InvPosition: q.InvPosition.replaceDB(db), + InvTrait: q.InvTrait.replaceDB(db), + InvType: q.InvType.replaceDB(db), + InvTypeMaterial: q.InvTypeMaterial.replaceDB(db), + InvTypeReaction: q.InvTypeReaction.replaceDB(db), + InvUniqueName: q.InvUniqueName.replaceDB(db), + InvVolume: q.InvVolume.replaceDB(db), + MapCelestialGraphic: q.MapCelestialGraphic.replaceDB(db), + MapCelestialStatistic: q.MapCelestialStatistic.replaceDB(db), + MapConstellation: q.MapConstellation.replaceDB(db), + MapConstellationJump: q.MapConstellationJump.replaceDB(db), + MapDenormalize: q.MapDenormalize.replaceDB(db), + MapJump: q.MapJump.replaceDB(db), + MapLandmark: q.MapLandmark.replaceDB(db), + MapLocationScene: q.MapLocationScene.replaceDB(db), + MapLocationWormholeClass: q.MapLocationWormholeClass.replaceDB(db), + MapRegion: q.MapRegion.replaceDB(db), + MapRegionJump: q.MapRegionJump.replaceDB(db), + MapSolarSystem: q.MapSolarSystem.replaceDB(db), + MapSolarSystemJump: q.MapSolarSystemJump.replaceDB(db), + MapUniverse: q.MapUniverse.replaceDB(db), + PlanetSchematic: q.PlanetSchematic.replaceDB(db), + PlanetSchematicsPinMap: q.PlanetSchematicsPinMap.replaceDB(db), + PlanetSchematicsTypeMap: q.PlanetSchematicsTypeMap.replaceDB(db), + RAMActivity: q.RAMActivity.replaceDB(db), + RAMAssemblyLineStation: q.RAMAssemblyLineStation.replaceDB(db), + RAMAssemblyLineType: q.RAMAssemblyLineType.replaceDB(db), + RAMAssemblyLineTypeDetailPerCategory: q.RAMAssemblyLineTypeDetailPerCategory.replaceDB(db), + RAMAssemblyLineTypeDetailPerGroup: q.RAMAssemblyLineTypeDetailPerGroup.replaceDB(db), + RAMInstallationTypeContent: q.RAMInstallationTypeContent.replaceDB(db), + Skin: q.Skin.replaceDB(db), + SkinLicense: q.SkinLicense.replaceDB(db), + SkinMaterial: q.SkinMaterial.replaceDB(db), + SkinShip: q.SkinShip.replaceDB(db), + StaOperation: q.StaOperation.replaceDB(db), + StaOperationService: q.StaOperationService.replaceDB(db), + StaService: q.StaService.replaceDB(db), + StaStation: q.StaStation.replaceDB(db), + StaStationType: q.StaStationType.replaceDB(db), + TranslationTable: q.TranslationTable.replaceDB(db), + TrnTranslation: q.TrnTranslation.replaceDB(db), + TrnTranslationColumn: q.TrnTranslationColumn.replaceDB(db), + TrnTranslationLanguage: q.TrnTranslationLanguage.replaceDB(db), + WarCombatZone: q.WarCombatZone.replaceDB(db), + WarCombatZoneSystem: q.WarCombatZoneSystem.replaceDB(db), + } +} + +type queryCtx struct { + AgtAgent *agtAgentDo + AgtAgentType *agtAgentTypeDo + AgtAgentsInSpace *agtAgentsInSpaceDo + AgtResearchAgent *agtResearchAgentDo + CertCert *certCertDo + CertMastery *certMasteryDo + CertSkill *certSkillDo + ChrAncestry *chrAncestryDo + ChrAttribute *chrAttributeDo + ChrBloodline *chrBloodlineDo + ChrFaction *chrFactionDo + ChrRace *chrRaceDo + CrpActivity *crpActivityDo + CrpNPCCorporation *crpNPCCorporationDo + CrpNPCCorporationDivision *crpNPCCorporationDivisionDo + CrpNPCCorporationResearchField *crpNPCCorporationResearchFieldDo + CrpNPCCorporationTrade *crpNPCCorporationTradeDo + CrpNPCDivision *crpNPCDivisionDo + DgmAttributeCategory *dgmAttributeCategoryDo + DgmAttributeType *dgmAttributeTypeDo + DgmEffect *dgmEffectDo + DgmExpression *dgmExpressionDo + DgmTypeAttribute *dgmTypeAttributeDo + DgmTypeEffect *dgmTypeEffectDo + EveGraphic *eveGraphicDo + EveIcon *eveIconDo + EveUnit *eveUnitDo + IndustryActivity *industryActivityDo + IndustryActivityMaterial *industryActivityMaterialDo + IndustryActivityProbability *industryActivityProbabilityDo + IndustryActivityProduct *industryActivityProductDo + IndustryActivityRace *industryActivityRaceDo + IndustryActivitySkill *industryActivitySkillDo + IndustryBlueprint *industryBlueprintDo + InvCategory *invCategoryDo + InvContrabandType *invContrabandTypeDo + InvControlTowerResource *invControlTowerResourceDo + InvControlTowerResourcePurpose *invControlTowerResourcePurposeDo + InvFlag *invFlagDo + InvGroup *invGroupDo + InvItem *invItemDo + InvMarketGroup *invMarketGroupDo + InvMetaGroup *invMetaGroupDo + InvMetaType *invMetaTypeDo + InvName *invNameDo + InvPosition *invPositionDo + InvTrait *invTraitDo + InvType *invTypeDo + InvTypeMaterial *invTypeMaterialDo + InvTypeReaction *invTypeReactionDo + InvUniqueName *invUniqueNameDo + InvVolume *invVolumeDo + MapCelestialGraphic *mapCelestialGraphicDo + MapCelestialStatistic *mapCelestialStatisticDo + MapConstellation *mapConstellationDo + MapConstellationJump *mapConstellationJumpDo + MapDenormalize *mapDenormalizeDo + MapJump *mapJumpDo + MapLandmark *mapLandmarkDo + MapLocationScene *mapLocationSceneDo + MapLocationWormholeClass *mapLocationWormholeClassDo + MapRegion *mapRegionDo + MapRegionJump *mapRegionJumpDo + MapSolarSystem *mapSolarSystemDo + MapSolarSystemJump *mapSolarSystemJumpDo + MapUniverse *mapUniverseDo + PlanetSchematic *planetSchematicDo + PlanetSchematicsPinMap *planetSchematicsPinMapDo + PlanetSchematicsTypeMap *planetSchematicsTypeMapDo + RAMActivity *rAMActivityDo + RAMAssemblyLineStation *rAMAssemblyLineStationDo + RAMAssemblyLineType *rAMAssemblyLineTypeDo + RAMAssemblyLineTypeDetailPerCategory *rAMAssemblyLineTypeDetailPerCategoryDo + RAMAssemblyLineTypeDetailPerGroup *rAMAssemblyLineTypeDetailPerGroupDo + RAMInstallationTypeContent *rAMInstallationTypeContentDo + Skin *skinDo + SkinLicense *skinLicenseDo + SkinMaterial *skinMaterialDo + SkinShip *skinShipDo + StaOperation *staOperationDo + StaOperationService *staOperationServiceDo + StaService *staServiceDo + StaStation *staStationDo + StaStationType *staStationTypeDo + TranslationTable *translationTableDo + TrnTranslation *trnTranslationDo + TrnTranslationColumn *trnTranslationColumnDo + TrnTranslationLanguage *trnTranslationLanguageDo + WarCombatZone *warCombatZoneDo + WarCombatZoneSystem *warCombatZoneSystemDo +} + +func (q *Query) WithContext(ctx context.Context) *queryCtx { + return &queryCtx{ + AgtAgent: q.AgtAgent.WithContext(ctx), + AgtAgentType: q.AgtAgentType.WithContext(ctx), + AgtAgentsInSpace: q.AgtAgentsInSpace.WithContext(ctx), + AgtResearchAgent: q.AgtResearchAgent.WithContext(ctx), + CertCert: q.CertCert.WithContext(ctx), + CertMastery: q.CertMastery.WithContext(ctx), + CertSkill: q.CertSkill.WithContext(ctx), + ChrAncestry: q.ChrAncestry.WithContext(ctx), + ChrAttribute: q.ChrAttribute.WithContext(ctx), + ChrBloodline: q.ChrBloodline.WithContext(ctx), + ChrFaction: q.ChrFaction.WithContext(ctx), + ChrRace: q.ChrRace.WithContext(ctx), + CrpActivity: q.CrpActivity.WithContext(ctx), + CrpNPCCorporation: q.CrpNPCCorporation.WithContext(ctx), + CrpNPCCorporationDivision: q.CrpNPCCorporationDivision.WithContext(ctx), + CrpNPCCorporationResearchField: q.CrpNPCCorporationResearchField.WithContext(ctx), + CrpNPCCorporationTrade: q.CrpNPCCorporationTrade.WithContext(ctx), + CrpNPCDivision: q.CrpNPCDivision.WithContext(ctx), + DgmAttributeCategory: q.DgmAttributeCategory.WithContext(ctx), + DgmAttributeType: q.DgmAttributeType.WithContext(ctx), + DgmEffect: q.DgmEffect.WithContext(ctx), + DgmExpression: q.DgmExpression.WithContext(ctx), + DgmTypeAttribute: q.DgmTypeAttribute.WithContext(ctx), + DgmTypeEffect: q.DgmTypeEffect.WithContext(ctx), + EveGraphic: q.EveGraphic.WithContext(ctx), + EveIcon: q.EveIcon.WithContext(ctx), + EveUnit: q.EveUnit.WithContext(ctx), + IndustryActivity: q.IndustryActivity.WithContext(ctx), + IndustryActivityMaterial: q.IndustryActivityMaterial.WithContext(ctx), + IndustryActivityProbability: q.IndustryActivityProbability.WithContext(ctx), + IndustryActivityProduct: q.IndustryActivityProduct.WithContext(ctx), + IndustryActivityRace: q.IndustryActivityRace.WithContext(ctx), + IndustryActivitySkill: q.IndustryActivitySkill.WithContext(ctx), + IndustryBlueprint: q.IndustryBlueprint.WithContext(ctx), + InvCategory: q.InvCategory.WithContext(ctx), + InvContrabandType: q.InvContrabandType.WithContext(ctx), + InvControlTowerResource: q.InvControlTowerResource.WithContext(ctx), + InvControlTowerResourcePurpose: q.InvControlTowerResourcePurpose.WithContext(ctx), + InvFlag: q.InvFlag.WithContext(ctx), + InvGroup: q.InvGroup.WithContext(ctx), + InvItem: q.InvItem.WithContext(ctx), + InvMarketGroup: q.InvMarketGroup.WithContext(ctx), + InvMetaGroup: q.InvMetaGroup.WithContext(ctx), + InvMetaType: q.InvMetaType.WithContext(ctx), + InvName: q.InvName.WithContext(ctx), + InvPosition: q.InvPosition.WithContext(ctx), + InvTrait: q.InvTrait.WithContext(ctx), + InvType: q.InvType.WithContext(ctx), + InvTypeMaterial: q.InvTypeMaterial.WithContext(ctx), + InvTypeReaction: q.InvTypeReaction.WithContext(ctx), + InvUniqueName: q.InvUniqueName.WithContext(ctx), + InvVolume: q.InvVolume.WithContext(ctx), + MapCelestialGraphic: q.MapCelestialGraphic.WithContext(ctx), + MapCelestialStatistic: q.MapCelestialStatistic.WithContext(ctx), + MapConstellation: q.MapConstellation.WithContext(ctx), + MapConstellationJump: q.MapConstellationJump.WithContext(ctx), + MapDenormalize: q.MapDenormalize.WithContext(ctx), + MapJump: q.MapJump.WithContext(ctx), + MapLandmark: q.MapLandmark.WithContext(ctx), + MapLocationScene: q.MapLocationScene.WithContext(ctx), + MapLocationWormholeClass: q.MapLocationWormholeClass.WithContext(ctx), + MapRegion: q.MapRegion.WithContext(ctx), + MapRegionJump: q.MapRegionJump.WithContext(ctx), + MapSolarSystem: q.MapSolarSystem.WithContext(ctx), + MapSolarSystemJump: q.MapSolarSystemJump.WithContext(ctx), + MapUniverse: q.MapUniverse.WithContext(ctx), + PlanetSchematic: q.PlanetSchematic.WithContext(ctx), + PlanetSchematicsPinMap: q.PlanetSchematicsPinMap.WithContext(ctx), + PlanetSchematicsTypeMap: q.PlanetSchematicsTypeMap.WithContext(ctx), + RAMActivity: q.RAMActivity.WithContext(ctx), + RAMAssemblyLineStation: q.RAMAssemblyLineStation.WithContext(ctx), + RAMAssemblyLineType: q.RAMAssemblyLineType.WithContext(ctx), + RAMAssemblyLineTypeDetailPerCategory: q.RAMAssemblyLineTypeDetailPerCategory.WithContext(ctx), + RAMAssemblyLineTypeDetailPerGroup: q.RAMAssemblyLineTypeDetailPerGroup.WithContext(ctx), + RAMInstallationTypeContent: q.RAMInstallationTypeContent.WithContext(ctx), + Skin: q.Skin.WithContext(ctx), + SkinLicense: q.SkinLicense.WithContext(ctx), + SkinMaterial: q.SkinMaterial.WithContext(ctx), + SkinShip: q.SkinShip.WithContext(ctx), + StaOperation: q.StaOperation.WithContext(ctx), + StaOperationService: q.StaOperationService.WithContext(ctx), + StaService: q.StaService.WithContext(ctx), + StaStation: q.StaStation.WithContext(ctx), + StaStationType: q.StaStationType.WithContext(ctx), + TranslationTable: q.TranslationTable.WithContext(ctx), + TrnTranslation: q.TrnTranslation.WithContext(ctx), + TrnTranslationColumn: q.TrnTranslationColumn.WithContext(ctx), + TrnTranslationLanguage: q.TrnTranslationLanguage.WithContext(ctx), + WarCombatZone: q.WarCombatZone.WithContext(ctx), + WarCombatZoneSystem: q.WarCombatZoneSystem.WithContext(ctx), + } +} + +func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error { + return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...) +} + +func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx { + tx := q.db.Begin(opts...) + return &QueryTx{Query: q.clone(tx), Error: tx.Error} +} + +type QueryTx struct { + *Query + Error error +} + +func (q *QueryTx) Commit() error { + return q.db.Commit().Error +} + +func (q *QueryTx) Rollback() error { + return q.db.Rollback().Error +} + +func (q *QueryTx) SavePoint(name string) error { + return q.db.SavePoint(name).Error +} + +func (q *QueryTx) RollbackTo(name string) error { + return q.db.RollbackTo(name).Error +} diff --git a/models/industryactivity.gen.go b/models/industryactivity.gen.go new file mode 100644 index 0000000..8aeb6e4 --- /dev/null +++ b/models/industryactivity.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivity(db *gorm.DB, opts ...gen.DOOption) industryActivity { + _industryActivity := industryActivity{} + + _industryActivity.industryActivityDo.UseDB(db, opts...) + _industryActivity.industryActivityDo.UseModel(&models.IndustryActivity{}) + + tableName := _industryActivity.industryActivityDo.TableName() + _industryActivity.ALL = field.NewAsterisk(tableName) + _industryActivity.TypeID = field.NewInt32(tableName, "typeID") + _industryActivity.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivity.Time = field.NewInt32(tableName, "time") + + _industryActivity.fillFieldMap() + + return _industryActivity +} + +type industryActivity struct { + industryActivityDo industryActivityDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + Time field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryActivity) Table(newTableName string) *industryActivity { + i.industryActivityDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivity) As(alias string) *industryActivity { + i.industryActivityDo.DO = *(i.industryActivityDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivity) updateTableName(table string) *industryActivity { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.Time = field.NewInt32(table, "time") + + i.fillFieldMap() + + return i +} + +func (i *industryActivity) WithContext(ctx context.Context) *industryActivityDo { + return i.industryActivityDo.WithContext(ctx) +} + +func (i industryActivity) TableName() string { return i.industryActivityDo.TableName() } + +func (i industryActivity) Alias() string { return i.industryActivityDo.Alias() } + +func (i industryActivity) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivityDo.Columns(cols...) +} + +func (i *industryActivity) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivity) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 3) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["time"] = i.Time +} + +func (i industryActivity) clone(db *gorm.DB) industryActivity { + i.industryActivityDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivity) replaceDB(db *gorm.DB) industryActivity { + i.industryActivityDo.ReplaceDB(db) + return i +} + +type industryActivityDo struct{ gen.DO } + +func (i industryActivityDo) Debug() *industryActivityDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivityDo) WithContext(ctx context.Context) *industryActivityDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivityDo) ReadDB() *industryActivityDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivityDo) WriteDB() *industryActivityDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivityDo) Session(config *gorm.Session) *industryActivityDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivityDo) Clauses(conds ...clause.Expression) *industryActivityDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivityDo) Returning(value interface{}, columns ...string) *industryActivityDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivityDo) Not(conds ...gen.Condition) *industryActivityDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivityDo) Or(conds ...gen.Condition) *industryActivityDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivityDo) Select(conds ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivityDo) Where(conds ...gen.Condition) *industryActivityDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivityDo) Order(conds ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivityDo) Distinct(cols ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivityDo) Omit(cols ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivityDo) Join(table schema.Tabler, on ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivityDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivityDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivityDo) Group(cols ...field.Expr) *industryActivityDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivityDo) Having(conds ...gen.Condition) *industryActivityDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivityDo) Limit(limit int) *industryActivityDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivityDo) Offset(offset int) *industryActivityDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivityDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivityDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivityDo) Unscoped() *industryActivityDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivityDo) Create(values ...*models.IndustryActivity) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivityDo) CreateInBatches(values []*models.IndustryActivity, batchSize int) error { + return i.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 (i industryActivityDo) Save(values ...*models.IndustryActivity) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivityDo) First() (*models.IndustryActivity, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivity), nil + } +} + +func (i industryActivityDo) Take() (*models.IndustryActivity, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivity), nil + } +} + +func (i industryActivityDo) Last() (*models.IndustryActivity, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivity), nil + } +} + +func (i industryActivityDo) Find() ([]*models.IndustryActivity, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivity), err +} + +func (i industryActivityDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivity, err error) { + buf := make([]*models.IndustryActivity, 0, batchSize) + err = i.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 (i industryActivityDo) FindInBatches(result *[]*models.IndustryActivity, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivityDo) Attrs(attrs ...field.AssignExpr) *industryActivityDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivityDo) Assign(attrs ...field.AssignExpr) *industryActivityDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivityDo) Joins(fields ...field.RelationField) *industryActivityDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivityDo) Preload(fields ...field.RelationField) *industryActivityDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivityDo) FirstOrInit() (*models.IndustryActivity, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivity), nil + } +} + +func (i industryActivityDo) FirstOrCreate() (*models.IndustryActivity, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivity), nil + } +} + +func (i industryActivityDo) FindByPage(offset int, limit int) (result []*models.IndustryActivity, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivityDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivityDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivityDo) Delete(models ...*models.IndustryActivity) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivityDo) withDO(do gen.Dao) *industryActivityDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryactivitymaterials.gen.go b/models/industryactivitymaterials.gen.go new file mode 100644 index 0000000..ceaa302 --- /dev/null +++ b/models/industryactivitymaterials.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivityMaterial(db *gorm.DB, opts ...gen.DOOption) industryActivityMaterial { + _industryActivityMaterial := industryActivityMaterial{} + + _industryActivityMaterial.industryActivityMaterialDo.UseDB(db, opts...) + _industryActivityMaterial.industryActivityMaterialDo.UseModel(&models.IndustryActivityMaterial{}) + + tableName := _industryActivityMaterial.industryActivityMaterialDo.TableName() + _industryActivityMaterial.ALL = field.NewAsterisk(tableName) + _industryActivityMaterial.TypeID = field.NewInt32(tableName, "typeID") + _industryActivityMaterial.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivityMaterial.MaterialTypeID = field.NewInt32(tableName, "materialTypeID") + _industryActivityMaterial.Quantity = field.NewInt32(tableName, "quantity") + + _industryActivityMaterial.fillFieldMap() + + return _industryActivityMaterial +} + +type industryActivityMaterial struct { + industryActivityMaterialDo industryActivityMaterialDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + MaterialTypeID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryActivityMaterial) Table(newTableName string) *industryActivityMaterial { + i.industryActivityMaterialDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivityMaterial) As(alias string) *industryActivityMaterial { + i.industryActivityMaterialDo.DO = *(i.industryActivityMaterialDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivityMaterial) updateTableName(table string) *industryActivityMaterial { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.MaterialTypeID = field.NewInt32(table, "materialTypeID") + i.Quantity = field.NewInt32(table, "quantity") + + i.fillFieldMap() + + return i +} + +func (i *industryActivityMaterial) WithContext(ctx context.Context) *industryActivityMaterialDo { + return i.industryActivityMaterialDo.WithContext(ctx) +} + +func (i industryActivityMaterial) TableName() string { return i.industryActivityMaterialDo.TableName() } + +func (i industryActivityMaterial) Alias() string { return i.industryActivityMaterialDo.Alias() } + +func (i industryActivityMaterial) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivityMaterialDo.Columns(cols...) +} + +func (i *industryActivityMaterial) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivityMaterial) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["materialTypeID"] = i.MaterialTypeID + i.fieldMap["quantity"] = i.Quantity +} + +func (i industryActivityMaterial) clone(db *gorm.DB) industryActivityMaterial { + i.industryActivityMaterialDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivityMaterial) replaceDB(db *gorm.DB) industryActivityMaterial { + i.industryActivityMaterialDo.ReplaceDB(db) + return i +} + +type industryActivityMaterialDo struct{ gen.DO } + +func (i industryActivityMaterialDo) Debug() *industryActivityMaterialDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivityMaterialDo) WithContext(ctx context.Context) *industryActivityMaterialDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivityMaterialDo) ReadDB() *industryActivityMaterialDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivityMaterialDo) WriteDB() *industryActivityMaterialDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivityMaterialDo) Session(config *gorm.Session) *industryActivityMaterialDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivityMaterialDo) Clauses(conds ...clause.Expression) *industryActivityMaterialDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivityMaterialDo) Returning(value interface{}, columns ...string) *industryActivityMaterialDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivityMaterialDo) Not(conds ...gen.Condition) *industryActivityMaterialDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivityMaterialDo) Or(conds ...gen.Condition) *industryActivityMaterialDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivityMaterialDo) Select(conds ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivityMaterialDo) Where(conds ...gen.Condition) *industryActivityMaterialDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivityMaterialDo) Order(conds ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivityMaterialDo) Distinct(cols ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivityMaterialDo) Omit(cols ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivityMaterialDo) Join(table schema.Tabler, on ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivityMaterialDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivityMaterialDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivityMaterialDo) Group(cols ...field.Expr) *industryActivityMaterialDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivityMaterialDo) Having(conds ...gen.Condition) *industryActivityMaterialDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivityMaterialDo) Limit(limit int) *industryActivityMaterialDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivityMaterialDo) Offset(offset int) *industryActivityMaterialDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivityMaterialDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivityMaterialDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivityMaterialDo) Unscoped() *industryActivityMaterialDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivityMaterialDo) Create(values ...*models.IndustryActivityMaterial) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivityMaterialDo) CreateInBatches(values []*models.IndustryActivityMaterial, batchSize int) error { + return i.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 (i industryActivityMaterialDo) Save(values ...*models.IndustryActivityMaterial) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivityMaterialDo) First() (*models.IndustryActivityMaterial, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityMaterial), nil + } +} + +func (i industryActivityMaterialDo) Take() (*models.IndustryActivityMaterial, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityMaterial), nil + } +} + +func (i industryActivityMaterialDo) Last() (*models.IndustryActivityMaterial, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityMaterial), nil + } +} + +func (i industryActivityMaterialDo) Find() ([]*models.IndustryActivityMaterial, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivityMaterial), err +} + +func (i industryActivityMaterialDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivityMaterial, err error) { + buf := make([]*models.IndustryActivityMaterial, 0, batchSize) + err = i.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 (i industryActivityMaterialDo) FindInBatches(result *[]*models.IndustryActivityMaterial, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivityMaterialDo) Attrs(attrs ...field.AssignExpr) *industryActivityMaterialDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivityMaterialDo) Assign(attrs ...field.AssignExpr) *industryActivityMaterialDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivityMaterialDo) Joins(fields ...field.RelationField) *industryActivityMaterialDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivityMaterialDo) Preload(fields ...field.RelationField) *industryActivityMaterialDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivityMaterialDo) FirstOrInit() (*models.IndustryActivityMaterial, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityMaterial), nil + } +} + +func (i industryActivityMaterialDo) FirstOrCreate() (*models.IndustryActivityMaterial, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityMaterial), nil + } +} + +func (i industryActivityMaterialDo) FindByPage(offset int, limit int) (result []*models.IndustryActivityMaterial, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivityMaterialDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivityMaterialDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivityMaterialDo) Delete(models ...*models.IndustryActivityMaterial) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivityMaterialDo) withDO(do gen.Dao) *industryActivityMaterialDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryactivityprobabilities.gen.go b/models/industryactivityprobabilities.gen.go new file mode 100644 index 0000000..cb6e428 --- /dev/null +++ b/models/industryactivityprobabilities.gen.go @@ -0,0 +1,345 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivityProbability(db *gorm.DB, opts ...gen.DOOption) industryActivityProbability { + _industryActivityProbability := industryActivityProbability{} + + _industryActivityProbability.industryActivityProbabilityDo.UseDB(db, opts...) + _industryActivityProbability.industryActivityProbabilityDo.UseModel(&models.IndustryActivityProbability{}) + + tableName := _industryActivityProbability.industryActivityProbabilityDo.TableName() + _industryActivityProbability.ALL = field.NewAsterisk(tableName) + _industryActivityProbability.TypeID = field.NewInt32(tableName, "typeID") + _industryActivityProbability.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivityProbability.ProductTypeID = field.NewInt32(tableName, "productTypeID") + _industryActivityProbability.Probability = field.NewFloat64(tableName, "probability") + + _industryActivityProbability.fillFieldMap() + + return _industryActivityProbability +} + +type industryActivityProbability struct { + industryActivityProbabilityDo industryActivityProbabilityDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + ProductTypeID field.Int32 + Probability field.Float64 + + fieldMap map[string]field.Expr +} + +func (i industryActivityProbability) Table(newTableName string) *industryActivityProbability { + i.industryActivityProbabilityDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivityProbability) As(alias string) *industryActivityProbability { + i.industryActivityProbabilityDo.DO = *(i.industryActivityProbabilityDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivityProbability) updateTableName(table string) *industryActivityProbability { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.ProductTypeID = field.NewInt32(table, "productTypeID") + i.Probability = field.NewFloat64(table, "probability") + + i.fillFieldMap() + + return i +} + +func (i *industryActivityProbability) WithContext(ctx context.Context) *industryActivityProbabilityDo { + return i.industryActivityProbabilityDo.WithContext(ctx) +} + +func (i industryActivityProbability) TableName() string { + return i.industryActivityProbabilityDo.TableName() +} + +func (i industryActivityProbability) Alias() string { return i.industryActivityProbabilityDo.Alias() } + +func (i industryActivityProbability) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivityProbabilityDo.Columns(cols...) +} + +func (i *industryActivityProbability) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivityProbability) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["productTypeID"] = i.ProductTypeID + i.fieldMap["probability"] = i.Probability +} + +func (i industryActivityProbability) clone(db *gorm.DB) industryActivityProbability { + i.industryActivityProbabilityDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivityProbability) replaceDB(db *gorm.DB) industryActivityProbability { + i.industryActivityProbabilityDo.ReplaceDB(db) + return i +} + +type industryActivityProbabilityDo struct{ gen.DO } + +func (i industryActivityProbabilityDo) Debug() *industryActivityProbabilityDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivityProbabilityDo) WithContext(ctx context.Context) *industryActivityProbabilityDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivityProbabilityDo) ReadDB() *industryActivityProbabilityDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivityProbabilityDo) WriteDB() *industryActivityProbabilityDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivityProbabilityDo) Session(config *gorm.Session) *industryActivityProbabilityDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivityProbabilityDo) Clauses(conds ...clause.Expression) *industryActivityProbabilityDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivityProbabilityDo) Returning(value interface{}, columns ...string) *industryActivityProbabilityDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivityProbabilityDo) Not(conds ...gen.Condition) *industryActivityProbabilityDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivityProbabilityDo) Or(conds ...gen.Condition) *industryActivityProbabilityDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivityProbabilityDo) Select(conds ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivityProbabilityDo) Where(conds ...gen.Condition) *industryActivityProbabilityDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivityProbabilityDo) Order(conds ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivityProbabilityDo) Distinct(cols ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivityProbabilityDo) Omit(cols ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivityProbabilityDo) Join(table schema.Tabler, on ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivityProbabilityDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivityProbabilityDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivityProbabilityDo) Group(cols ...field.Expr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivityProbabilityDo) Having(conds ...gen.Condition) *industryActivityProbabilityDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivityProbabilityDo) Limit(limit int) *industryActivityProbabilityDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivityProbabilityDo) Offset(offset int) *industryActivityProbabilityDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivityProbabilityDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivityProbabilityDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivityProbabilityDo) Unscoped() *industryActivityProbabilityDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivityProbabilityDo) Create(values ...*models.IndustryActivityProbability) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivityProbabilityDo) CreateInBatches(values []*models.IndustryActivityProbability, batchSize int) error { + return i.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 (i industryActivityProbabilityDo) Save(values ...*models.IndustryActivityProbability) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivityProbabilityDo) First() (*models.IndustryActivityProbability, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProbability), nil + } +} + +func (i industryActivityProbabilityDo) Take() (*models.IndustryActivityProbability, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProbability), nil + } +} + +func (i industryActivityProbabilityDo) Last() (*models.IndustryActivityProbability, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProbability), nil + } +} + +func (i industryActivityProbabilityDo) Find() ([]*models.IndustryActivityProbability, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivityProbability), err +} + +func (i industryActivityProbabilityDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivityProbability, err error) { + buf := make([]*models.IndustryActivityProbability, 0, batchSize) + err = i.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 (i industryActivityProbabilityDo) FindInBatches(result *[]*models.IndustryActivityProbability, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivityProbabilityDo) Attrs(attrs ...field.AssignExpr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivityProbabilityDo) Assign(attrs ...field.AssignExpr) *industryActivityProbabilityDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivityProbabilityDo) Joins(fields ...field.RelationField) *industryActivityProbabilityDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivityProbabilityDo) Preload(fields ...field.RelationField) *industryActivityProbabilityDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivityProbabilityDo) FirstOrInit() (*models.IndustryActivityProbability, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProbability), nil + } +} + +func (i industryActivityProbabilityDo) FirstOrCreate() (*models.IndustryActivityProbability, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProbability), nil + } +} + +func (i industryActivityProbabilityDo) FindByPage(offset int, limit int) (result []*models.IndustryActivityProbability, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivityProbabilityDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivityProbabilityDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivityProbabilityDo) Delete(models ...*models.IndustryActivityProbability) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivityProbabilityDo) withDO(do gen.Dao) *industryActivityProbabilityDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryactivityproducts.gen.go b/models/industryactivityproducts.gen.go new file mode 100644 index 0000000..e2b138d --- /dev/null +++ b/models/industryactivityproducts.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivityProduct(db *gorm.DB, opts ...gen.DOOption) industryActivityProduct { + _industryActivityProduct := industryActivityProduct{} + + _industryActivityProduct.industryActivityProductDo.UseDB(db, opts...) + _industryActivityProduct.industryActivityProductDo.UseModel(&models.IndustryActivityProduct{}) + + tableName := _industryActivityProduct.industryActivityProductDo.TableName() + _industryActivityProduct.ALL = field.NewAsterisk(tableName) + _industryActivityProduct.TypeID = field.NewInt32(tableName, "typeID") + _industryActivityProduct.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivityProduct.ProductTypeID = field.NewInt32(tableName, "productTypeID") + _industryActivityProduct.Quantity = field.NewInt32(tableName, "quantity") + + _industryActivityProduct.fillFieldMap() + + return _industryActivityProduct +} + +type industryActivityProduct struct { + industryActivityProductDo industryActivityProductDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + ProductTypeID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryActivityProduct) Table(newTableName string) *industryActivityProduct { + i.industryActivityProductDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivityProduct) As(alias string) *industryActivityProduct { + i.industryActivityProductDo.DO = *(i.industryActivityProductDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivityProduct) updateTableName(table string) *industryActivityProduct { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.ProductTypeID = field.NewInt32(table, "productTypeID") + i.Quantity = field.NewInt32(table, "quantity") + + i.fillFieldMap() + + return i +} + +func (i *industryActivityProduct) WithContext(ctx context.Context) *industryActivityProductDo { + return i.industryActivityProductDo.WithContext(ctx) +} + +func (i industryActivityProduct) TableName() string { return i.industryActivityProductDo.TableName() } + +func (i industryActivityProduct) Alias() string { return i.industryActivityProductDo.Alias() } + +func (i industryActivityProduct) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivityProductDo.Columns(cols...) +} + +func (i *industryActivityProduct) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivityProduct) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["productTypeID"] = i.ProductTypeID + i.fieldMap["quantity"] = i.Quantity +} + +func (i industryActivityProduct) clone(db *gorm.DB) industryActivityProduct { + i.industryActivityProductDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivityProduct) replaceDB(db *gorm.DB) industryActivityProduct { + i.industryActivityProductDo.ReplaceDB(db) + return i +} + +type industryActivityProductDo struct{ gen.DO } + +func (i industryActivityProductDo) Debug() *industryActivityProductDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivityProductDo) WithContext(ctx context.Context) *industryActivityProductDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivityProductDo) ReadDB() *industryActivityProductDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivityProductDo) WriteDB() *industryActivityProductDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivityProductDo) Session(config *gorm.Session) *industryActivityProductDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivityProductDo) Clauses(conds ...clause.Expression) *industryActivityProductDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivityProductDo) Returning(value interface{}, columns ...string) *industryActivityProductDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivityProductDo) Not(conds ...gen.Condition) *industryActivityProductDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivityProductDo) Or(conds ...gen.Condition) *industryActivityProductDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivityProductDo) Select(conds ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivityProductDo) Where(conds ...gen.Condition) *industryActivityProductDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivityProductDo) Order(conds ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivityProductDo) Distinct(cols ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivityProductDo) Omit(cols ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivityProductDo) Join(table schema.Tabler, on ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivityProductDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivityProductDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivityProductDo) Group(cols ...field.Expr) *industryActivityProductDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivityProductDo) Having(conds ...gen.Condition) *industryActivityProductDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivityProductDo) Limit(limit int) *industryActivityProductDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivityProductDo) Offset(offset int) *industryActivityProductDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivityProductDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivityProductDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivityProductDo) Unscoped() *industryActivityProductDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivityProductDo) Create(values ...*models.IndustryActivityProduct) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivityProductDo) CreateInBatches(values []*models.IndustryActivityProduct, batchSize int) error { + return i.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 (i industryActivityProductDo) Save(values ...*models.IndustryActivityProduct) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivityProductDo) First() (*models.IndustryActivityProduct, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProduct), nil + } +} + +func (i industryActivityProductDo) Take() (*models.IndustryActivityProduct, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProduct), nil + } +} + +func (i industryActivityProductDo) Last() (*models.IndustryActivityProduct, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProduct), nil + } +} + +func (i industryActivityProductDo) Find() ([]*models.IndustryActivityProduct, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivityProduct), err +} + +func (i industryActivityProductDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivityProduct, err error) { + buf := make([]*models.IndustryActivityProduct, 0, batchSize) + err = i.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 (i industryActivityProductDo) FindInBatches(result *[]*models.IndustryActivityProduct, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivityProductDo) Attrs(attrs ...field.AssignExpr) *industryActivityProductDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivityProductDo) Assign(attrs ...field.AssignExpr) *industryActivityProductDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivityProductDo) Joins(fields ...field.RelationField) *industryActivityProductDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivityProductDo) Preload(fields ...field.RelationField) *industryActivityProductDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivityProductDo) FirstOrInit() (*models.IndustryActivityProduct, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProduct), nil + } +} + +func (i industryActivityProductDo) FirstOrCreate() (*models.IndustryActivityProduct, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityProduct), nil + } +} + +func (i industryActivityProductDo) FindByPage(offset int, limit int) (result []*models.IndustryActivityProduct, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivityProductDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivityProductDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivityProductDo) Delete(models ...*models.IndustryActivityProduct) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivityProductDo) withDO(do gen.Dao) *industryActivityProductDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryactivityraces.gen.go b/models/industryactivityraces.gen.go new file mode 100644 index 0000000..f8e6e87 --- /dev/null +++ b/models/industryactivityraces.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivityRace(db *gorm.DB, opts ...gen.DOOption) industryActivityRace { + _industryActivityRace := industryActivityRace{} + + _industryActivityRace.industryActivityRaceDo.UseDB(db, opts...) + _industryActivityRace.industryActivityRaceDo.UseModel(&models.IndustryActivityRace{}) + + tableName := _industryActivityRace.industryActivityRaceDo.TableName() + _industryActivityRace.ALL = field.NewAsterisk(tableName) + _industryActivityRace.TypeID = field.NewInt32(tableName, "typeID") + _industryActivityRace.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivityRace.ProductTypeID = field.NewInt32(tableName, "productTypeID") + _industryActivityRace.RaceID = field.NewInt32(tableName, "raceID") + + _industryActivityRace.fillFieldMap() + + return _industryActivityRace +} + +type industryActivityRace struct { + industryActivityRaceDo industryActivityRaceDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + ProductTypeID field.Int32 + RaceID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryActivityRace) Table(newTableName string) *industryActivityRace { + i.industryActivityRaceDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivityRace) As(alias string) *industryActivityRace { + i.industryActivityRaceDo.DO = *(i.industryActivityRaceDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivityRace) updateTableName(table string) *industryActivityRace { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.ProductTypeID = field.NewInt32(table, "productTypeID") + i.RaceID = field.NewInt32(table, "raceID") + + i.fillFieldMap() + + return i +} + +func (i *industryActivityRace) WithContext(ctx context.Context) *industryActivityRaceDo { + return i.industryActivityRaceDo.WithContext(ctx) +} + +func (i industryActivityRace) TableName() string { return i.industryActivityRaceDo.TableName() } + +func (i industryActivityRace) Alias() string { return i.industryActivityRaceDo.Alias() } + +func (i industryActivityRace) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivityRaceDo.Columns(cols...) +} + +func (i *industryActivityRace) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivityRace) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["productTypeID"] = i.ProductTypeID + i.fieldMap["raceID"] = i.RaceID +} + +func (i industryActivityRace) clone(db *gorm.DB) industryActivityRace { + i.industryActivityRaceDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivityRace) replaceDB(db *gorm.DB) industryActivityRace { + i.industryActivityRaceDo.ReplaceDB(db) + return i +} + +type industryActivityRaceDo struct{ gen.DO } + +func (i industryActivityRaceDo) Debug() *industryActivityRaceDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivityRaceDo) WithContext(ctx context.Context) *industryActivityRaceDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivityRaceDo) ReadDB() *industryActivityRaceDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivityRaceDo) WriteDB() *industryActivityRaceDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivityRaceDo) Session(config *gorm.Session) *industryActivityRaceDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivityRaceDo) Clauses(conds ...clause.Expression) *industryActivityRaceDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivityRaceDo) Returning(value interface{}, columns ...string) *industryActivityRaceDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivityRaceDo) Not(conds ...gen.Condition) *industryActivityRaceDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivityRaceDo) Or(conds ...gen.Condition) *industryActivityRaceDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivityRaceDo) Select(conds ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivityRaceDo) Where(conds ...gen.Condition) *industryActivityRaceDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivityRaceDo) Order(conds ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivityRaceDo) Distinct(cols ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivityRaceDo) Omit(cols ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivityRaceDo) Join(table schema.Tabler, on ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivityRaceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivityRaceDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivityRaceDo) Group(cols ...field.Expr) *industryActivityRaceDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivityRaceDo) Having(conds ...gen.Condition) *industryActivityRaceDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivityRaceDo) Limit(limit int) *industryActivityRaceDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivityRaceDo) Offset(offset int) *industryActivityRaceDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivityRaceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivityRaceDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivityRaceDo) Unscoped() *industryActivityRaceDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivityRaceDo) Create(values ...*models.IndustryActivityRace) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivityRaceDo) CreateInBatches(values []*models.IndustryActivityRace, batchSize int) error { + return i.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 (i industryActivityRaceDo) Save(values ...*models.IndustryActivityRace) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivityRaceDo) First() (*models.IndustryActivityRace, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityRace), nil + } +} + +func (i industryActivityRaceDo) Take() (*models.IndustryActivityRace, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityRace), nil + } +} + +func (i industryActivityRaceDo) Last() (*models.IndustryActivityRace, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityRace), nil + } +} + +func (i industryActivityRaceDo) Find() ([]*models.IndustryActivityRace, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivityRace), err +} + +func (i industryActivityRaceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivityRace, err error) { + buf := make([]*models.IndustryActivityRace, 0, batchSize) + err = i.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 (i industryActivityRaceDo) FindInBatches(result *[]*models.IndustryActivityRace, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivityRaceDo) Attrs(attrs ...field.AssignExpr) *industryActivityRaceDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivityRaceDo) Assign(attrs ...field.AssignExpr) *industryActivityRaceDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivityRaceDo) Joins(fields ...field.RelationField) *industryActivityRaceDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivityRaceDo) Preload(fields ...field.RelationField) *industryActivityRaceDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivityRaceDo) FirstOrInit() (*models.IndustryActivityRace, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityRace), nil + } +} + +func (i industryActivityRaceDo) FirstOrCreate() (*models.IndustryActivityRace, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivityRace), nil + } +} + +func (i industryActivityRaceDo) FindByPage(offset int, limit int) (result []*models.IndustryActivityRace, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivityRaceDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivityRaceDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivityRaceDo) Delete(models ...*models.IndustryActivityRace) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivityRaceDo) withDO(do gen.Dao) *industryActivityRaceDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryactivityskills.gen.go b/models/industryactivityskills.gen.go new file mode 100644 index 0000000..b8f9c64 --- /dev/null +++ b/models/industryactivityskills.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryActivitySkill(db *gorm.DB, opts ...gen.DOOption) industryActivitySkill { + _industryActivitySkill := industryActivitySkill{} + + _industryActivitySkill.industryActivitySkillDo.UseDB(db, opts...) + _industryActivitySkill.industryActivitySkillDo.UseModel(&models.IndustryActivitySkill{}) + + tableName := _industryActivitySkill.industryActivitySkillDo.TableName() + _industryActivitySkill.ALL = field.NewAsterisk(tableName) + _industryActivitySkill.TypeID = field.NewInt32(tableName, "typeID") + _industryActivitySkill.ActivityID = field.NewInt32(tableName, "activityID") + _industryActivitySkill.SkillID = field.NewInt32(tableName, "skillID") + _industryActivitySkill.Level = field.NewInt32(tableName, "level") + + _industryActivitySkill.fillFieldMap() + + return _industryActivitySkill +} + +type industryActivitySkill struct { + industryActivitySkillDo industryActivitySkillDo + + ALL field.Asterisk + TypeID field.Int32 + ActivityID field.Int32 + SkillID field.Int32 + Level field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryActivitySkill) Table(newTableName string) *industryActivitySkill { + i.industryActivitySkillDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryActivitySkill) As(alias string) *industryActivitySkill { + i.industryActivitySkillDo.DO = *(i.industryActivitySkillDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryActivitySkill) updateTableName(table string) *industryActivitySkill { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ActivityID = field.NewInt32(table, "activityID") + i.SkillID = field.NewInt32(table, "skillID") + i.Level = field.NewInt32(table, "level") + + i.fillFieldMap() + + return i +} + +func (i *industryActivitySkill) WithContext(ctx context.Context) *industryActivitySkillDo { + return i.industryActivitySkillDo.WithContext(ctx) +} + +func (i industryActivitySkill) TableName() string { return i.industryActivitySkillDo.TableName() } + +func (i industryActivitySkill) Alias() string { return i.industryActivitySkillDo.Alias() } + +func (i industryActivitySkill) Columns(cols ...field.Expr) gen.Columns { + return i.industryActivitySkillDo.Columns(cols...) +} + +func (i *industryActivitySkill) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryActivitySkill) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["activityID"] = i.ActivityID + i.fieldMap["skillID"] = i.SkillID + i.fieldMap["level"] = i.Level +} + +func (i industryActivitySkill) clone(db *gorm.DB) industryActivitySkill { + i.industryActivitySkillDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryActivitySkill) replaceDB(db *gorm.DB) industryActivitySkill { + i.industryActivitySkillDo.ReplaceDB(db) + return i +} + +type industryActivitySkillDo struct{ gen.DO } + +func (i industryActivitySkillDo) Debug() *industryActivitySkillDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryActivitySkillDo) WithContext(ctx context.Context) *industryActivitySkillDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryActivitySkillDo) ReadDB() *industryActivitySkillDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryActivitySkillDo) WriteDB() *industryActivitySkillDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryActivitySkillDo) Session(config *gorm.Session) *industryActivitySkillDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryActivitySkillDo) Clauses(conds ...clause.Expression) *industryActivitySkillDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryActivitySkillDo) Returning(value interface{}, columns ...string) *industryActivitySkillDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryActivitySkillDo) Not(conds ...gen.Condition) *industryActivitySkillDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryActivitySkillDo) Or(conds ...gen.Condition) *industryActivitySkillDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryActivitySkillDo) Select(conds ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryActivitySkillDo) Where(conds ...gen.Condition) *industryActivitySkillDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryActivitySkillDo) Order(conds ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryActivitySkillDo) Distinct(cols ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryActivitySkillDo) Omit(cols ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryActivitySkillDo) Join(table schema.Tabler, on ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryActivitySkillDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryActivitySkillDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryActivitySkillDo) Group(cols ...field.Expr) *industryActivitySkillDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryActivitySkillDo) Having(conds ...gen.Condition) *industryActivitySkillDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryActivitySkillDo) Limit(limit int) *industryActivitySkillDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryActivitySkillDo) Offset(offset int) *industryActivitySkillDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryActivitySkillDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryActivitySkillDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryActivitySkillDo) Unscoped() *industryActivitySkillDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryActivitySkillDo) Create(values ...*models.IndustryActivitySkill) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryActivitySkillDo) CreateInBatches(values []*models.IndustryActivitySkill, batchSize int) error { + return i.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 (i industryActivitySkillDo) Save(values ...*models.IndustryActivitySkill) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryActivitySkillDo) First() (*models.IndustryActivitySkill, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivitySkill), nil + } +} + +func (i industryActivitySkillDo) Take() (*models.IndustryActivitySkill, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivitySkill), nil + } +} + +func (i industryActivitySkillDo) Last() (*models.IndustryActivitySkill, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivitySkill), nil + } +} + +func (i industryActivitySkillDo) Find() ([]*models.IndustryActivitySkill, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryActivitySkill), err +} + +func (i industryActivitySkillDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryActivitySkill, err error) { + buf := make([]*models.IndustryActivitySkill, 0, batchSize) + err = i.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 (i industryActivitySkillDo) FindInBatches(result *[]*models.IndustryActivitySkill, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryActivitySkillDo) Attrs(attrs ...field.AssignExpr) *industryActivitySkillDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryActivitySkillDo) Assign(attrs ...field.AssignExpr) *industryActivitySkillDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryActivitySkillDo) Joins(fields ...field.RelationField) *industryActivitySkillDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryActivitySkillDo) Preload(fields ...field.RelationField) *industryActivitySkillDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryActivitySkillDo) FirstOrInit() (*models.IndustryActivitySkill, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivitySkill), nil + } +} + +func (i industryActivitySkillDo) FirstOrCreate() (*models.IndustryActivitySkill, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryActivitySkill), nil + } +} + +func (i industryActivitySkillDo) FindByPage(offset int, limit int) (result []*models.IndustryActivitySkill, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryActivitySkillDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryActivitySkillDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryActivitySkillDo) Delete(models ...*models.IndustryActivitySkill) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryActivitySkillDo) withDO(do gen.Dao) *industryActivitySkillDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/industryblueprints.gen.go b/models/industryblueprints.gen.go new file mode 100644 index 0000000..29420bb --- /dev/null +++ b/models/industryblueprints.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newIndustryBlueprint(db *gorm.DB, opts ...gen.DOOption) industryBlueprint { + _industryBlueprint := industryBlueprint{} + + _industryBlueprint.industryBlueprintDo.UseDB(db, opts...) + _industryBlueprint.industryBlueprintDo.UseModel(&models.IndustryBlueprint{}) + + tableName := _industryBlueprint.industryBlueprintDo.TableName() + _industryBlueprint.ALL = field.NewAsterisk(tableName) + _industryBlueprint.TypeID = field.NewInt32(tableName, "typeID") + _industryBlueprint.MaxProductionLimit = field.NewInt32(tableName, "maxProductionLimit") + + _industryBlueprint.fillFieldMap() + + return _industryBlueprint +} + +type industryBlueprint struct { + industryBlueprintDo industryBlueprintDo + + ALL field.Asterisk + TypeID field.Int32 + MaxProductionLimit field.Int32 + + fieldMap map[string]field.Expr +} + +func (i industryBlueprint) Table(newTableName string) *industryBlueprint { + i.industryBlueprintDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i industryBlueprint) As(alias string) *industryBlueprint { + i.industryBlueprintDo.DO = *(i.industryBlueprintDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *industryBlueprint) updateTableName(table string) *industryBlueprint { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.MaxProductionLimit = field.NewInt32(table, "maxProductionLimit") + + i.fillFieldMap() + + return i +} + +func (i *industryBlueprint) WithContext(ctx context.Context) *industryBlueprintDo { + return i.industryBlueprintDo.WithContext(ctx) +} + +func (i industryBlueprint) TableName() string { return i.industryBlueprintDo.TableName() } + +func (i industryBlueprint) Alias() string { return i.industryBlueprintDo.Alias() } + +func (i industryBlueprint) Columns(cols ...field.Expr) gen.Columns { + return i.industryBlueprintDo.Columns(cols...) +} + +func (i *industryBlueprint) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *industryBlueprint) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 2) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["maxProductionLimit"] = i.MaxProductionLimit +} + +func (i industryBlueprint) clone(db *gorm.DB) industryBlueprint { + i.industryBlueprintDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i industryBlueprint) replaceDB(db *gorm.DB) industryBlueprint { + i.industryBlueprintDo.ReplaceDB(db) + return i +} + +type industryBlueprintDo struct{ gen.DO } + +func (i industryBlueprintDo) Debug() *industryBlueprintDo { + return i.withDO(i.DO.Debug()) +} + +func (i industryBlueprintDo) WithContext(ctx context.Context) *industryBlueprintDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i industryBlueprintDo) ReadDB() *industryBlueprintDo { + return i.Clauses(dbresolver.Read) +} + +func (i industryBlueprintDo) WriteDB() *industryBlueprintDo { + return i.Clauses(dbresolver.Write) +} + +func (i industryBlueprintDo) Session(config *gorm.Session) *industryBlueprintDo { + return i.withDO(i.DO.Session(config)) +} + +func (i industryBlueprintDo) Clauses(conds ...clause.Expression) *industryBlueprintDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i industryBlueprintDo) Returning(value interface{}, columns ...string) *industryBlueprintDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i industryBlueprintDo) Not(conds ...gen.Condition) *industryBlueprintDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i industryBlueprintDo) Or(conds ...gen.Condition) *industryBlueprintDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i industryBlueprintDo) Select(conds ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i industryBlueprintDo) Where(conds ...gen.Condition) *industryBlueprintDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i industryBlueprintDo) Order(conds ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i industryBlueprintDo) Distinct(cols ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i industryBlueprintDo) Omit(cols ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i industryBlueprintDo) Join(table schema.Tabler, on ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i industryBlueprintDo) LeftJoin(table schema.Tabler, on ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i industryBlueprintDo) RightJoin(table schema.Tabler, on ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i industryBlueprintDo) Group(cols ...field.Expr) *industryBlueprintDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i industryBlueprintDo) Having(conds ...gen.Condition) *industryBlueprintDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i industryBlueprintDo) Limit(limit int) *industryBlueprintDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i industryBlueprintDo) Offset(offset int) *industryBlueprintDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i industryBlueprintDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *industryBlueprintDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i industryBlueprintDo) Unscoped() *industryBlueprintDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i industryBlueprintDo) Create(values ...*models.IndustryBlueprint) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i industryBlueprintDo) CreateInBatches(values []*models.IndustryBlueprint, batchSize int) error { + return i.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 (i industryBlueprintDo) Save(values ...*models.IndustryBlueprint) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i industryBlueprintDo) First() (*models.IndustryBlueprint, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.IndustryBlueprint), nil + } +} + +func (i industryBlueprintDo) Take() (*models.IndustryBlueprint, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.IndustryBlueprint), nil + } +} + +func (i industryBlueprintDo) Last() (*models.IndustryBlueprint, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.IndustryBlueprint), nil + } +} + +func (i industryBlueprintDo) Find() ([]*models.IndustryBlueprint, error) { + result, err := i.DO.Find() + return result.([]*models.IndustryBlueprint), err +} + +func (i industryBlueprintDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.IndustryBlueprint, err error) { + buf := make([]*models.IndustryBlueprint, 0, batchSize) + err = i.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 (i industryBlueprintDo) FindInBatches(result *[]*models.IndustryBlueprint, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i industryBlueprintDo) Attrs(attrs ...field.AssignExpr) *industryBlueprintDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i industryBlueprintDo) Assign(attrs ...field.AssignExpr) *industryBlueprintDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i industryBlueprintDo) Joins(fields ...field.RelationField) *industryBlueprintDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i industryBlueprintDo) Preload(fields ...field.RelationField) *industryBlueprintDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i industryBlueprintDo) FirstOrInit() (*models.IndustryBlueprint, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.IndustryBlueprint), nil + } +} + +func (i industryBlueprintDo) FirstOrCreate() (*models.IndustryBlueprint, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.IndustryBlueprint), nil + } +} + +func (i industryBlueprintDo) FindByPage(offset int, limit int) (result []*models.IndustryBlueprint, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i industryBlueprintDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i industryBlueprintDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i industryBlueprintDo) Delete(models ...*models.IndustryBlueprint) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *industryBlueprintDo) withDO(do gen.Dao) *industryBlueprintDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invcategories.gen.go b/models/invcategories.gen.go new file mode 100644 index 0000000..aa05f80 --- /dev/null +++ b/models/invcategories.gen.go @@ -0,0 +1,341 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvCategory(db *gorm.DB, opts ...gen.DOOption) invCategory { + _invCategory := invCategory{} + + _invCategory.invCategoryDo.UseDB(db, opts...) + _invCategory.invCategoryDo.UseModel(&models.InvCategory{}) + + tableName := _invCategory.invCategoryDo.TableName() + _invCategory.ALL = field.NewAsterisk(tableName) + _invCategory.CategoryID = field.NewInt32(tableName, "categoryID") + _invCategory.CategoryName = field.NewString(tableName, "categoryName") + _invCategory.IconID = field.NewInt32(tableName, "iconID") + _invCategory.Published = field.NewBool(tableName, "published") + + _invCategory.fillFieldMap() + + return _invCategory +} + +type invCategory struct { + invCategoryDo invCategoryDo + + ALL field.Asterisk + CategoryID field.Int32 + CategoryName field.String + IconID field.Int32 + Published field.Bool + + fieldMap map[string]field.Expr +} + +func (i invCategory) Table(newTableName string) *invCategory { + i.invCategoryDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invCategory) As(alias string) *invCategory { + i.invCategoryDo.DO = *(i.invCategoryDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invCategory) updateTableName(table string) *invCategory { + i.ALL = field.NewAsterisk(table) + i.CategoryID = field.NewInt32(table, "categoryID") + i.CategoryName = field.NewString(table, "categoryName") + i.IconID = field.NewInt32(table, "iconID") + i.Published = field.NewBool(table, "published") + + i.fillFieldMap() + + return i +} + +func (i *invCategory) WithContext(ctx context.Context) *invCategoryDo { + return i.invCategoryDo.WithContext(ctx) +} + +func (i invCategory) TableName() string { return i.invCategoryDo.TableName() } + +func (i invCategory) Alias() string { return i.invCategoryDo.Alias() } + +func (i invCategory) Columns(cols ...field.Expr) gen.Columns { return i.invCategoryDo.Columns(cols...) } + +func (i *invCategory) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invCategory) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["categoryID"] = i.CategoryID + i.fieldMap["categoryName"] = i.CategoryName + i.fieldMap["iconID"] = i.IconID + i.fieldMap["published"] = i.Published +} + +func (i invCategory) clone(db *gorm.DB) invCategory { + i.invCategoryDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invCategory) replaceDB(db *gorm.DB) invCategory { + i.invCategoryDo.ReplaceDB(db) + return i +} + +type invCategoryDo struct{ gen.DO } + +func (i invCategoryDo) Debug() *invCategoryDo { + return i.withDO(i.DO.Debug()) +} + +func (i invCategoryDo) WithContext(ctx context.Context) *invCategoryDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invCategoryDo) ReadDB() *invCategoryDo { + return i.Clauses(dbresolver.Read) +} + +func (i invCategoryDo) WriteDB() *invCategoryDo { + return i.Clauses(dbresolver.Write) +} + +func (i invCategoryDo) Session(config *gorm.Session) *invCategoryDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invCategoryDo) Clauses(conds ...clause.Expression) *invCategoryDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invCategoryDo) Returning(value interface{}, columns ...string) *invCategoryDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invCategoryDo) Not(conds ...gen.Condition) *invCategoryDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invCategoryDo) Or(conds ...gen.Condition) *invCategoryDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invCategoryDo) Select(conds ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invCategoryDo) Where(conds ...gen.Condition) *invCategoryDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invCategoryDo) Order(conds ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invCategoryDo) Distinct(cols ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invCategoryDo) Omit(cols ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invCategoryDo) Join(table schema.Tabler, on ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invCategoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invCategoryDo) RightJoin(table schema.Tabler, on ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invCategoryDo) Group(cols ...field.Expr) *invCategoryDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invCategoryDo) Having(conds ...gen.Condition) *invCategoryDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invCategoryDo) Limit(limit int) *invCategoryDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invCategoryDo) Offset(offset int) *invCategoryDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invCategoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invCategoryDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invCategoryDo) Unscoped() *invCategoryDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invCategoryDo) Create(values ...*models.InvCategory) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invCategoryDo) CreateInBatches(values []*models.InvCategory, batchSize int) error { + return i.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 (i invCategoryDo) Save(values ...*models.InvCategory) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invCategoryDo) First() (*models.InvCategory, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvCategory), nil + } +} + +func (i invCategoryDo) Take() (*models.InvCategory, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvCategory), nil + } +} + +func (i invCategoryDo) Last() (*models.InvCategory, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvCategory), nil + } +} + +func (i invCategoryDo) Find() ([]*models.InvCategory, error) { + result, err := i.DO.Find() + return result.([]*models.InvCategory), err +} + +func (i invCategoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvCategory, err error) { + buf := make([]*models.InvCategory, 0, batchSize) + err = i.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 (i invCategoryDo) FindInBatches(result *[]*models.InvCategory, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invCategoryDo) Attrs(attrs ...field.AssignExpr) *invCategoryDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invCategoryDo) Assign(attrs ...field.AssignExpr) *invCategoryDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invCategoryDo) Joins(fields ...field.RelationField) *invCategoryDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invCategoryDo) Preload(fields ...field.RelationField) *invCategoryDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invCategoryDo) FirstOrInit() (*models.InvCategory, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvCategory), nil + } +} + +func (i invCategoryDo) FirstOrCreate() (*models.InvCategory, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvCategory), nil + } +} + +func (i invCategoryDo) FindByPage(offset int, limit int) (result []*models.InvCategory, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invCategoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invCategoryDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invCategoryDo) Delete(models ...*models.InvCategory) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invCategoryDo) withDO(do gen.Dao) *invCategoryDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invcontrabandtypes.gen.go b/models/invcontrabandtypes.gen.go new file mode 100644 index 0000000..cd373d4 --- /dev/null +++ b/models/invcontrabandtypes.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvContrabandType(db *gorm.DB, opts ...gen.DOOption) invContrabandType { + _invContrabandType := invContrabandType{} + + _invContrabandType.invContrabandTypeDo.UseDB(db, opts...) + _invContrabandType.invContrabandTypeDo.UseModel(&models.InvContrabandType{}) + + tableName := _invContrabandType.invContrabandTypeDo.TableName() + _invContrabandType.ALL = field.NewAsterisk(tableName) + _invContrabandType.FactionID = field.NewInt32(tableName, "factionID") + _invContrabandType.TypeID = field.NewInt32(tableName, "typeID") + _invContrabandType.StandingLoss = field.NewFloat64(tableName, "standingLoss") + _invContrabandType.ConfiscateMinSec = field.NewFloat64(tableName, "confiscateMinSec") + _invContrabandType.FineByValue = field.NewFloat64(tableName, "fineByValue") + _invContrabandType.AttackMinSec = field.NewFloat64(tableName, "attackMinSec") + + _invContrabandType.fillFieldMap() + + return _invContrabandType +} + +type invContrabandType struct { + invContrabandTypeDo invContrabandTypeDo + + ALL field.Asterisk + FactionID field.Int32 + TypeID field.Int32 + StandingLoss field.Float64 + ConfiscateMinSec field.Float64 + FineByValue field.Float64 + AttackMinSec field.Float64 + + fieldMap map[string]field.Expr +} + +func (i invContrabandType) Table(newTableName string) *invContrabandType { + i.invContrabandTypeDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invContrabandType) As(alias string) *invContrabandType { + i.invContrabandTypeDo.DO = *(i.invContrabandTypeDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invContrabandType) updateTableName(table string) *invContrabandType { + i.ALL = field.NewAsterisk(table) + i.FactionID = field.NewInt32(table, "factionID") + i.TypeID = field.NewInt32(table, "typeID") + i.StandingLoss = field.NewFloat64(table, "standingLoss") + i.ConfiscateMinSec = field.NewFloat64(table, "confiscateMinSec") + i.FineByValue = field.NewFloat64(table, "fineByValue") + i.AttackMinSec = field.NewFloat64(table, "attackMinSec") + + i.fillFieldMap() + + return i +} + +func (i *invContrabandType) WithContext(ctx context.Context) *invContrabandTypeDo { + return i.invContrabandTypeDo.WithContext(ctx) +} + +func (i invContrabandType) TableName() string { return i.invContrabandTypeDo.TableName() } + +func (i invContrabandType) Alias() string { return i.invContrabandTypeDo.Alias() } + +func (i invContrabandType) Columns(cols ...field.Expr) gen.Columns { + return i.invContrabandTypeDo.Columns(cols...) +} + +func (i *invContrabandType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invContrabandType) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["factionID"] = i.FactionID + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["standingLoss"] = i.StandingLoss + i.fieldMap["confiscateMinSec"] = i.ConfiscateMinSec + i.fieldMap["fineByValue"] = i.FineByValue + i.fieldMap["attackMinSec"] = i.AttackMinSec +} + +func (i invContrabandType) clone(db *gorm.DB) invContrabandType { + i.invContrabandTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invContrabandType) replaceDB(db *gorm.DB) invContrabandType { + i.invContrabandTypeDo.ReplaceDB(db) + return i +} + +type invContrabandTypeDo struct{ gen.DO } + +func (i invContrabandTypeDo) Debug() *invContrabandTypeDo { + return i.withDO(i.DO.Debug()) +} + +func (i invContrabandTypeDo) WithContext(ctx context.Context) *invContrabandTypeDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invContrabandTypeDo) ReadDB() *invContrabandTypeDo { + return i.Clauses(dbresolver.Read) +} + +func (i invContrabandTypeDo) WriteDB() *invContrabandTypeDo { + return i.Clauses(dbresolver.Write) +} + +func (i invContrabandTypeDo) Session(config *gorm.Session) *invContrabandTypeDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invContrabandTypeDo) Clauses(conds ...clause.Expression) *invContrabandTypeDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invContrabandTypeDo) Returning(value interface{}, columns ...string) *invContrabandTypeDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invContrabandTypeDo) Not(conds ...gen.Condition) *invContrabandTypeDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invContrabandTypeDo) Or(conds ...gen.Condition) *invContrabandTypeDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invContrabandTypeDo) Select(conds ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invContrabandTypeDo) Where(conds ...gen.Condition) *invContrabandTypeDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invContrabandTypeDo) Order(conds ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invContrabandTypeDo) Distinct(cols ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invContrabandTypeDo) Omit(cols ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invContrabandTypeDo) Join(table schema.Tabler, on ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invContrabandTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invContrabandTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invContrabandTypeDo) Group(cols ...field.Expr) *invContrabandTypeDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invContrabandTypeDo) Having(conds ...gen.Condition) *invContrabandTypeDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invContrabandTypeDo) Limit(limit int) *invContrabandTypeDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invContrabandTypeDo) Offset(offset int) *invContrabandTypeDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invContrabandTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invContrabandTypeDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invContrabandTypeDo) Unscoped() *invContrabandTypeDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invContrabandTypeDo) Create(values ...*models.InvContrabandType) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invContrabandTypeDo) CreateInBatches(values []*models.InvContrabandType, batchSize int) error { + return i.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 (i invContrabandTypeDo) Save(values ...*models.InvContrabandType) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invContrabandTypeDo) First() (*models.InvContrabandType, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvContrabandType), nil + } +} + +func (i invContrabandTypeDo) Take() (*models.InvContrabandType, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvContrabandType), nil + } +} + +func (i invContrabandTypeDo) Last() (*models.InvContrabandType, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvContrabandType), nil + } +} + +func (i invContrabandTypeDo) Find() ([]*models.InvContrabandType, error) { + result, err := i.DO.Find() + return result.([]*models.InvContrabandType), err +} + +func (i invContrabandTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvContrabandType, err error) { + buf := make([]*models.InvContrabandType, 0, batchSize) + err = i.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 (i invContrabandTypeDo) FindInBatches(result *[]*models.InvContrabandType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invContrabandTypeDo) Attrs(attrs ...field.AssignExpr) *invContrabandTypeDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invContrabandTypeDo) Assign(attrs ...field.AssignExpr) *invContrabandTypeDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invContrabandTypeDo) Joins(fields ...field.RelationField) *invContrabandTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invContrabandTypeDo) Preload(fields ...field.RelationField) *invContrabandTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invContrabandTypeDo) FirstOrInit() (*models.InvContrabandType, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvContrabandType), nil + } +} + +func (i invContrabandTypeDo) FirstOrCreate() (*models.InvContrabandType, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvContrabandType), nil + } +} + +func (i invContrabandTypeDo) FindByPage(offset int, limit int) (result []*models.InvContrabandType, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invContrabandTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invContrabandTypeDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invContrabandTypeDo) Delete(models ...*models.InvContrabandType) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invContrabandTypeDo) withDO(do gen.Dao) *invContrabandTypeDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invcontroltowerresourcepurposes.gen.go b/models/invcontroltowerresourcepurposes.gen.go new file mode 100644 index 0000000..d96a4d7 --- /dev/null +++ b/models/invcontroltowerresourcepurposes.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvControlTowerResourcePurpose(db *gorm.DB, opts ...gen.DOOption) invControlTowerResourcePurpose { + _invControlTowerResourcePurpose := invControlTowerResourcePurpose{} + + _invControlTowerResourcePurpose.invControlTowerResourcePurposeDo.UseDB(db, opts...) + _invControlTowerResourcePurpose.invControlTowerResourcePurposeDo.UseModel(&models.InvControlTowerResourcePurpose{}) + + tableName := _invControlTowerResourcePurpose.invControlTowerResourcePurposeDo.TableName() + _invControlTowerResourcePurpose.ALL = field.NewAsterisk(tableName) + _invControlTowerResourcePurpose.Purpose = field.NewInt32(tableName, "purpose") + _invControlTowerResourcePurpose.PurposeText = field.NewString(tableName, "purposeText") + + _invControlTowerResourcePurpose.fillFieldMap() + + return _invControlTowerResourcePurpose +} + +type invControlTowerResourcePurpose struct { + invControlTowerResourcePurposeDo invControlTowerResourcePurposeDo + + ALL field.Asterisk + Purpose field.Int32 + PurposeText field.String + + fieldMap map[string]field.Expr +} + +func (i invControlTowerResourcePurpose) Table(newTableName string) *invControlTowerResourcePurpose { + i.invControlTowerResourcePurposeDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invControlTowerResourcePurpose) As(alias string) *invControlTowerResourcePurpose { + i.invControlTowerResourcePurposeDo.DO = *(i.invControlTowerResourcePurposeDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invControlTowerResourcePurpose) updateTableName(table string) *invControlTowerResourcePurpose { + i.ALL = field.NewAsterisk(table) + i.Purpose = field.NewInt32(table, "purpose") + i.PurposeText = field.NewString(table, "purposeText") + + i.fillFieldMap() + + return i +} + +func (i *invControlTowerResourcePurpose) WithContext(ctx context.Context) *invControlTowerResourcePurposeDo { + return i.invControlTowerResourcePurposeDo.WithContext(ctx) +} + +func (i invControlTowerResourcePurpose) TableName() string { + return i.invControlTowerResourcePurposeDo.TableName() +} + +func (i invControlTowerResourcePurpose) Alias() string { + return i.invControlTowerResourcePurposeDo.Alias() +} + +func (i invControlTowerResourcePurpose) Columns(cols ...field.Expr) gen.Columns { + return i.invControlTowerResourcePurposeDo.Columns(cols...) +} + +func (i *invControlTowerResourcePurpose) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invControlTowerResourcePurpose) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 2) + i.fieldMap["purpose"] = i.Purpose + i.fieldMap["purposeText"] = i.PurposeText +} + +func (i invControlTowerResourcePurpose) clone(db *gorm.DB) invControlTowerResourcePurpose { + i.invControlTowerResourcePurposeDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invControlTowerResourcePurpose) replaceDB(db *gorm.DB) invControlTowerResourcePurpose { + i.invControlTowerResourcePurposeDo.ReplaceDB(db) + return i +} + +type invControlTowerResourcePurposeDo struct{ gen.DO } + +func (i invControlTowerResourcePurposeDo) Debug() *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Debug()) +} + +func (i invControlTowerResourcePurposeDo) WithContext(ctx context.Context) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invControlTowerResourcePurposeDo) ReadDB() *invControlTowerResourcePurposeDo { + return i.Clauses(dbresolver.Read) +} + +func (i invControlTowerResourcePurposeDo) WriteDB() *invControlTowerResourcePurposeDo { + return i.Clauses(dbresolver.Write) +} + +func (i invControlTowerResourcePurposeDo) Session(config *gorm.Session) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invControlTowerResourcePurposeDo) Clauses(conds ...clause.Expression) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Returning(value interface{}, columns ...string) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invControlTowerResourcePurposeDo) Not(conds ...gen.Condition) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Or(conds ...gen.Condition) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Select(conds ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Where(conds ...gen.Condition) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Order(conds ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Distinct(cols ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invControlTowerResourcePurposeDo) Omit(cols ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invControlTowerResourcePurposeDo) Join(table schema.Tabler, on ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invControlTowerResourcePurposeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invControlTowerResourcePurposeDo) RightJoin(table schema.Tabler, on ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invControlTowerResourcePurposeDo) Group(cols ...field.Expr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invControlTowerResourcePurposeDo) Having(conds ...gen.Condition) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invControlTowerResourcePurposeDo) Limit(limit int) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invControlTowerResourcePurposeDo) Offset(offset int) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invControlTowerResourcePurposeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invControlTowerResourcePurposeDo) Unscoped() *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invControlTowerResourcePurposeDo) Create(values ...*models.InvControlTowerResourcePurpose) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invControlTowerResourcePurposeDo) CreateInBatches(values []*models.InvControlTowerResourcePurpose, batchSize int) error { + return i.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 (i invControlTowerResourcePurposeDo) Save(values ...*models.InvControlTowerResourcePurpose) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invControlTowerResourcePurposeDo) First() (*models.InvControlTowerResourcePurpose, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResourcePurpose), nil + } +} + +func (i invControlTowerResourcePurposeDo) Take() (*models.InvControlTowerResourcePurpose, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResourcePurpose), nil + } +} + +func (i invControlTowerResourcePurposeDo) Last() (*models.InvControlTowerResourcePurpose, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResourcePurpose), nil + } +} + +func (i invControlTowerResourcePurposeDo) Find() ([]*models.InvControlTowerResourcePurpose, error) { + result, err := i.DO.Find() + return result.([]*models.InvControlTowerResourcePurpose), err +} + +func (i invControlTowerResourcePurposeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvControlTowerResourcePurpose, err error) { + buf := make([]*models.InvControlTowerResourcePurpose, 0, batchSize) + err = i.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 (i invControlTowerResourcePurposeDo) FindInBatches(result *[]*models.InvControlTowerResourcePurpose, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invControlTowerResourcePurposeDo) Attrs(attrs ...field.AssignExpr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invControlTowerResourcePurposeDo) Assign(attrs ...field.AssignExpr) *invControlTowerResourcePurposeDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invControlTowerResourcePurposeDo) Joins(fields ...field.RelationField) *invControlTowerResourcePurposeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invControlTowerResourcePurposeDo) Preload(fields ...field.RelationField) *invControlTowerResourcePurposeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invControlTowerResourcePurposeDo) FirstOrInit() (*models.InvControlTowerResourcePurpose, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResourcePurpose), nil + } +} + +func (i invControlTowerResourcePurposeDo) FirstOrCreate() (*models.InvControlTowerResourcePurpose, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResourcePurpose), nil + } +} + +func (i invControlTowerResourcePurposeDo) FindByPage(offset int, limit int) (result []*models.InvControlTowerResourcePurpose, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invControlTowerResourcePurposeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invControlTowerResourcePurposeDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invControlTowerResourcePurposeDo) Delete(models ...*models.InvControlTowerResourcePurpose) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invControlTowerResourcePurposeDo) withDO(do gen.Dao) *invControlTowerResourcePurposeDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invcontroltowerresources.gen.go b/models/invcontroltowerresources.gen.go new file mode 100644 index 0000000..e3bf111 --- /dev/null +++ b/models/invcontroltowerresources.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvControlTowerResource(db *gorm.DB, opts ...gen.DOOption) invControlTowerResource { + _invControlTowerResource := invControlTowerResource{} + + _invControlTowerResource.invControlTowerResourceDo.UseDB(db, opts...) + _invControlTowerResource.invControlTowerResourceDo.UseModel(&models.InvControlTowerResource{}) + + tableName := _invControlTowerResource.invControlTowerResourceDo.TableName() + _invControlTowerResource.ALL = field.NewAsterisk(tableName) + _invControlTowerResource.ControlTowerTypeID = field.NewInt32(tableName, "controlTowerTypeID") + _invControlTowerResource.ResourceTypeID = field.NewInt32(tableName, "resourceTypeID") + _invControlTowerResource.Purpose = field.NewInt32(tableName, "purpose") + _invControlTowerResource.Quantity = field.NewInt32(tableName, "quantity") + _invControlTowerResource.MinSecurityLevel = field.NewFloat64(tableName, "minSecurityLevel") + _invControlTowerResource.FactionID = field.NewInt32(tableName, "factionID") + + _invControlTowerResource.fillFieldMap() + + return _invControlTowerResource +} + +type invControlTowerResource struct { + invControlTowerResourceDo invControlTowerResourceDo + + ALL field.Asterisk + ControlTowerTypeID field.Int32 + ResourceTypeID field.Int32 + Purpose field.Int32 + Quantity field.Int32 + MinSecurityLevel field.Float64 + FactionID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invControlTowerResource) Table(newTableName string) *invControlTowerResource { + i.invControlTowerResourceDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invControlTowerResource) As(alias string) *invControlTowerResource { + i.invControlTowerResourceDo.DO = *(i.invControlTowerResourceDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invControlTowerResource) updateTableName(table string) *invControlTowerResource { + i.ALL = field.NewAsterisk(table) + i.ControlTowerTypeID = field.NewInt32(table, "controlTowerTypeID") + i.ResourceTypeID = field.NewInt32(table, "resourceTypeID") + i.Purpose = field.NewInt32(table, "purpose") + i.Quantity = field.NewInt32(table, "quantity") + i.MinSecurityLevel = field.NewFloat64(table, "minSecurityLevel") + i.FactionID = field.NewInt32(table, "factionID") + + i.fillFieldMap() + + return i +} + +func (i *invControlTowerResource) WithContext(ctx context.Context) *invControlTowerResourceDo { + return i.invControlTowerResourceDo.WithContext(ctx) +} + +func (i invControlTowerResource) TableName() string { return i.invControlTowerResourceDo.TableName() } + +func (i invControlTowerResource) Alias() string { return i.invControlTowerResourceDo.Alias() } + +func (i invControlTowerResource) Columns(cols ...field.Expr) gen.Columns { + return i.invControlTowerResourceDo.Columns(cols...) +} + +func (i *invControlTowerResource) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invControlTowerResource) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["controlTowerTypeID"] = i.ControlTowerTypeID + i.fieldMap["resourceTypeID"] = i.ResourceTypeID + i.fieldMap["purpose"] = i.Purpose + i.fieldMap["quantity"] = i.Quantity + i.fieldMap["minSecurityLevel"] = i.MinSecurityLevel + i.fieldMap["factionID"] = i.FactionID +} + +func (i invControlTowerResource) clone(db *gorm.DB) invControlTowerResource { + i.invControlTowerResourceDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invControlTowerResource) replaceDB(db *gorm.DB) invControlTowerResource { + i.invControlTowerResourceDo.ReplaceDB(db) + return i +} + +type invControlTowerResourceDo struct{ gen.DO } + +func (i invControlTowerResourceDo) Debug() *invControlTowerResourceDo { + return i.withDO(i.DO.Debug()) +} + +func (i invControlTowerResourceDo) WithContext(ctx context.Context) *invControlTowerResourceDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invControlTowerResourceDo) ReadDB() *invControlTowerResourceDo { + return i.Clauses(dbresolver.Read) +} + +func (i invControlTowerResourceDo) WriteDB() *invControlTowerResourceDo { + return i.Clauses(dbresolver.Write) +} + +func (i invControlTowerResourceDo) Session(config *gorm.Session) *invControlTowerResourceDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invControlTowerResourceDo) Clauses(conds ...clause.Expression) *invControlTowerResourceDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invControlTowerResourceDo) Returning(value interface{}, columns ...string) *invControlTowerResourceDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invControlTowerResourceDo) Not(conds ...gen.Condition) *invControlTowerResourceDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invControlTowerResourceDo) Or(conds ...gen.Condition) *invControlTowerResourceDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invControlTowerResourceDo) Select(conds ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invControlTowerResourceDo) Where(conds ...gen.Condition) *invControlTowerResourceDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invControlTowerResourceDo) Order(conds ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invControlTowerResourceDo) Distinct(cols ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invControlTowerResourceDo) Omit(cols ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invControlTowerResourceDo) Join(table schema.Tabler, on ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invControlTowerResourceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invControlTowerResourceDo) RightJoin(table schema.Tabler, on ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invControlTowerResourceDo) Group(cols ...field.Expr) *invControlTowerResourceDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invControlTowerResourceDo) Having(conds ...gen.Condition) *invControlTowerResourceDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invControlTowerResourceDo) Limit(limit int) *invControlTowerResourceDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invControlTowerResourceDo) Offset(offset int) *invControlTowerResourceDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invControlTowerResourceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invControlTowerResourceDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invControlTowerResourceDo) Unscoped() *invControlTowerResourceDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invControlTowerResourceDo) Create(values ...*models.InvControlTowerResource) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invControlTowerResourceDo) CreateInBatches(values []*models.InvControlTowerResource, batchSize int) error { + return i.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 (i invControlTowerResourceDo) Save(values ...*models.InvControlTowerResource) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invControlTowerResourceDo) First() (*models.InvControlTowerResource, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResource), nil + } +} + +func (i invControlTowerResourceDo) Take() (*models.InvControlTowerResource, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResource), nil + } +} + +func (i invControlTowerResourceDo) Last() (*models.InvControlTowerResource, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResource), nil + } +} + +func (i invControlTowerResourceDo) Find() ([]*models.InvControlTowerResource, error) { + result, err := i.DO.Find() + return result.([]*models.InvControlTowerResource), err +} + +func (i invControlTowerResourceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvControlTowerResource, err error) { + buf := make([]*models.InvControlTowerResource, 0, batchSize) + err = i.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 (i invControlTowerResourceDo) FindInBatches(result *[]*models.InvControlTowerResource, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invControlTowerResourceDo) Attrs(attrs ...field.AssignExpr) *invControlTowerResourceDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invControlTowerResourceDo) Assign(attrs ...field.AssignExpr) *invControlTowerResourceDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invControlTowerResourceDo) Joins(fields ...field.RelationField) *invControlTowerResourceDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invControlTowerResourceDo) Preload(fields ...field.RelationField) *invControlTowerResourceDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invControlTowerResourceDo) FirstOrInit() (*models.InvControlTowerResource, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResource), nil + } +} + +func (i invControlTowerResourceDo) FirstOrCreate() (*models.InvControlTowerResource, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvControlTowerResource), nil + } +} + +func (i invControlTowerResourceDo) FindByPage(offset int, limit int) (result []*models.InvControlTowerResource, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invControlTowerResourceDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invControlTowerResourceDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invControlTowerResourceDo) Delete(models ...*models.InvControlTowerResource) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invControlTowerResourceDo) withDO(do gen.Dao) *invControlTowerResourceDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invflags.gen.go b/models/invflags.gen.go new file mode 100644 index 0000000..e32cf4c --- /dev/null +++ b/models/invflags.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvFlag(db *gorm.DB, opts ...gen.DOOption) invFlag { + _invFlag := invFlag{} + + _invFlag.invFlagDo.UseDB(db, opts...) + _invFlag.invFlagDo.UseModel(&models.InvFlag{}) + + tableName := _invFlag.invFlagDo.TableName() + _invFlag.ALL = field.NewAsterisk(tableName) + _invFlag.FlagID = field.NewInt32(tableName, "flagID") + _invFlag.FlagName = field.NewString(tableName, "flagName") + _invFlag.FlagText = field.NewString(tableName, "flagText") + _invFlag.OrderID = field.NewInt32(tableName, "orderID") + + _invFlag.fillFieldMap() + + return _invFlag +} + +type invFlag struct { + invFlagDo invFlagDo + + ALL field.Asterisk + FlagID field.Int32 + FlagName field.String + FlagText field.String + OrderID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invFlag) Table(newTableName string) *invFlag { + i.invFlagDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invFlag) As(alias string) *invFlag { + i.invFlagDo.DO = *(i.invFlagDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invFlag) updateTableName(table string) *invFlag { + i.ALL = field.NewAsterisk(table) + i.FlagID = field.NewInt32(table, "flagID") + i.FlagName = field.NewString(table, "flagName") + i.FlagText = field.NewString(table, "flagText") + i.OrderID = field.NewInt32(table, "orderID") + + i.fillFieldMap() + + return i +} + +func (i *invFlag) WithContext(ctx context.Context) *invFlagDo { return i.invFlagDo.WithContext(ctx) } + +func (i invFlag) TableName() string { return i.invFlagDo.TableName() } + +func (i invFlag) Alias() string { return i.invFlagDo.Alias() } + +func (i invFlag) Columns(cols ...field.Expr) gen.Columns { return i.invFlagDo.Columns(cols...) } + +func (i *invFlag) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invFlag) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["flagID"] = i.FlagID + i.fieldMap["flagName"] = i.FlagName + i.fieldMap["flagText"] = i.FlagText + i.fieldMap["orderID"] = i.OrderID +} + +func (i invFlag) clone(db *gorm.DB) invFlag { + i.invFlagDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invFlag) replaceDB(db *gorm.DB) invFlag { + i.invFlagDo.ReplaceDB(db) + return i +} + +type invFlagDo struct{ gen.DO } + +func (i invFlagDo) Debug() *invFlagDo { + return i.withDO(i.DO.Debug()) +} + +func (i invFlagDo) WithContext(ctx context.Context) *invFlagDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invFlagDo) ReadDB() *invFlagDo { + return i.Clauses(dbresolver.Read) +} + +func (i invFlagDo) WriteDB() *invFlagDo { + return i.Clauses(dbresolver.Write) +} + +func (i invFlagDo) Session(config *gorm.Session) *invFlagDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invFlagDo) Clauses(conds ...clause.Expression) *invFlagDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invFlagDo) Returning(value interface{}, columns ...string) *invFlagDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invFlagDo) Not(conds ...gen.Condition) *invFlagDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invFlagDo) Or(conds ...gen.Condition) *invFlagDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invFlagDo) Select(conds ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invFlagDo) Where(conds ...gen.Condition) *invFlagDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invFlagDo) Order(conds ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invFlagDo) Distinct(cols ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invFlagDo) Omit(cols ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invFlagDo) Join(table schema.Tabler, on ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invFlagDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invFlagDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invFlagDo) RightJoin(table schema.Tabler, on ...field.Expr) *invFlagDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invFlagDo) Group(cols ...field.Expr) *invFlagDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invFlagDo) Having(conds ...gen.Condition) *invFlagDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invFlagDo) Limit(limit int) *invFlagDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invFlagDo) Offset(offset int) *invFlagDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invFlagDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invFlagDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invFlagDo) Unscoped() *invFlagDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invFlagDo) Create(values ...*models.InvFlag) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invFlagDo) CreateInBatches(values []*models.InvFlag, batchSize int) error { + return i.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 (i invFlagDo) Save(values ...*models.InvFlag) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invFlagDo) First() (*models.InvFlag, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvFlag), nil + } +} + +func (i invFlagDo) Take() (*models.InvFlag, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvFlag), nil + } +} + +func (i invFlagDo) Last() (*models.InvFlag, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvFlag), nil + } +} + +func (i invFlagDo) Find() ([]*models.InvFlag, error) { + result, err := i.DO.Find() + return result.([]*models.InvFlag), err +} + +func (i invFlagDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvFlag, err error) { + buf := make([]*models.InvFlag, 0, batchSize) + err = i.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 (i invFlagDo) FindInBatches(result *[]*models.InvFlag, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invFlagDo) Attrs(attrs ...field.AssignExpr) *invFlagDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invFlagDo) Assign(attrs ...field.AssignExpr) *invFlagDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invFlagDo) Joins(fields ...field.RelationField) *invFlagDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invFlagDo) Preload(fields ...field.RelationField) *invFlagDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invFlagDo) FirstOrInit() (*models.InvFlag, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvFlag), nil + } +} + +func (i invFlagDo) FirstOrCreate() (*models.InvFlag, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvFlag), nil + } +} + +func (i invFlagDo) FindByPage(offset int, limit int) (result []*models.InvFlag, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invFlagDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invFlagDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invFlagDo) Delete(models ...*models.InvFlag) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invFlagDo) withDO(do gen.Dao) *invFlagDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invgroups.gen.go b/models/invgroups.gen.go new file mode 100644 index 0000000..18875b7 --- /dev/null +++ b/models/invgroups.gen.go @@ -0,0 +1,359 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvGroup(db *gorm.DB, opts ...gen.DOOption) invGroup { + _invGroup := invGroup{} + + _invGroup.invGroupDo.UseDB(db, opts...) + _invGroup.invGroupDo.UseModel(&models.InvGroup{}) + + tableName := _invGroup.invGroupDo.TableName() + _invGroup.ALL = field.NewAsterisk(tableName) + _invGroup.GroupID = field.NewInt32(tableName, "groupID") + _invGroup.CategoryID = field.NewInt32(tableName, "categoryID") + _invGroup.GroupName = field.NewString(tableName, "groupName") + _invGroup.IconID = field.NewInt32(tableName, "iconID") + _invGroup.UseBasePrice = field.NewBool(tableName, "useBasePrice") + _invGroup.Anchored = field.NewBool(tableName, "anchored") + _invGroup.Anchorable = field.NewBool(tableName, "anchorable") + _invGroup.FittableNonSingleton = field.NewBool(tableName, "fittableNonSingleton") + _invGroup.Published = field.NewBool(tableName, "published") + + _invGroup.fillFieldMap() + + return _invGroup +} + +type invGroup struct { + invGroupDo invGroupDo + + ALL field.Asterisk + GroupID field.Int32 + CategoryID field.Int32 + GroupName field.String + IconID field.Int32 + UseBasePrice field.Bool + Anchored field.Bool + Anchorable field.Bool + FittableNonSingleton field.Bool + Published field.Bool + + fieldMap map[string]field.Expr +} + +func (i invGroup) Table(newTableName string) *invGroup { + i.invGroupDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invGroup) As(alias string) *invGroup { + i.invGroupDo.DO = *(i.invGroupDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invGroup) updateTableName(table string) *invGroup { + i.ALL = field.NewAsterisk(table) + i.GroupID = field.NewInt32(table, "groupID") + i.CategoryID = field.NewInt32(table, "categoryID") + i.GroupName = field.NewString(table, "groupName") + i.IconID = field.NewInt32(table, "iconID") + i.UseBasePrice = field.NewBool(table, "useBasePrice") + i.Anchored = field.NewBool(table, "anchored") + i.Anchorable = field.NewBool(table, "anchorable") + i.FittableNonSingleton = field.NewBool(table, "fittableNonSingleton") + i.Published = field.NewBool(table, "published") + + i.fillFieldMap() + + return i +} + +func (i *invGroup) WithContext(ctx context.Context) *invGroupDo { return i.invGroupDo.WithContext(ctx) } + +func (i invGroup) TableName() string { return i.invGroupDo.TableName() } + +func (i invGroup) Alias() string { return i.invGroupDo.Alias() } + +func (i invGroup) Columns(cols ...field.Expr) gen.Columns { return i.invGroupDo.Columns(cols...) } + +func (i *invGroup) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invGroup) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 9) + i.fieldMap["groupID"] = i.GroupID + i.fieldMap["categoryID"] = i.CategoryID + i.fieldMap["groupName"] = i.GroupName + i.fieldMap["iconID"] = i.IconID + i.fieldMap["useBasePrice"] = i.UseBasePrice + i.fieldMap["anchored"] = i.Anchored + i.fieldMap["anchorable"] = i.Anchorable + i.fieldMap["fittableNonSingleton"] = i.FittableNonSingleton + i.fieldMap["published"] = i.Published +} + +func (i invGroup) clone(db *gorm.DB) invGroup { + i.invGroupDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invGroup) replaceDB(db *gorm.DB) invGroup { + i.invGroupDo.ReplaceDB(db) + return i +} + +type invGroupDo struct{ gen.DO } + +func (i invGroupDo) Debug() *invGroupDo { + return i.withDO(i.DO.Debug()) +} + +func (i invGroupDo) WithContext(ctx context.Context) *invGroupDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invGroupDo) ReadDB() *invGroupDo { + return i.Clauses(dbresolver.Read) +} + +func (i invGroupDo) WriteDB() *invGroupDo { + return i.Clauses(dbresolver.Write) +} + +func (i invGroupDo) Session(config *gorm.Session) *invGroupDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invGroupDo) Clauses(conds ...clause.Expression) *invGroupDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invGroupDo) Returning(value interface{}, columns ...string) *invGroupDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invGroupDo) Not(conds ...gen.Condition) *invGroupDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invGroupDo) Or(conds ...gen.Condition) *invGroupDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invGroupDo) Select(conds ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invGroupDo) Where(conds ...gen.Condition) *invGroupDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invGroupDo) Order(conds ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invGroupDo) Distinct(cols ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invGroupDo) Omit(cols ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invGroupDo) Join(table schema.Tabler, on ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invGroupDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) *invGroupDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invGroupDo) Group(cols ...field.Expr) *invGroupDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invGroupDo) Having(conds ...gen.Condition) *invGroupDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invGroupDo) Limit(limit int) *invGroupDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invGroupDo) Offset(offset int) *invGroupDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invGroupDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invGroupDo) Unscoped() *invGroupDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invGroupDo) Create(values ...*models.InvGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invGroupDo) CreateInBatches(values []*models.InvGroup, batchSize int) error { + return i.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 (i invGroupDo) Save(values ...*models.InvGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invGroupDo) First() (*models.InvGroup, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvGroup), nil + } +} + +func (i invGroupDo) Take() (*models.InvGroup, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvGroup), nil + } +} + +func (i invGroupDo) Last() (*models.InvGroup, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvGroup), nil + } +} + +func (i invGroupDo) Find() ([]*models.InvGroup, error) { + result, err := i.DO.Find() + return result.([]*models.InvGroup), err +} + +func (i invGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvGroup, err error) { + buf := make([]*models.InvGroup, 0, batchSize) + err = i.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 (i invGroupDo) FindInBatches(result *[]*models.InvGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invGroupDo) Attrs(attrs ...field.AssignExpr) *invGroupDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invGroupDo) Assign(attrs ...field.AssignExpr) *invGroupDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invGroupDo) Joins(fields ...field.RelationField) *invGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invGroupDo) Preload(fields ...field.RelationField) *invGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invGroupDo) FirstOrInit() (*models.InvGroup, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvGroup), nil + } +} + +func (i invGroupDo) FirstOrCreate() (*models.InvGroup, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvGroup), nil + } +} + +func (i invGroupDo) FindByPage(offset int, limit int) (result []*models.InvGroup, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invGroupDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invGroupDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invGroupDo) Delete(models ...*models.InvGroup) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invGroupDo) withDO(do gen.Dao) *invGroupDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invitems.gen.go b/models/invitems.gen.go new file mode 100644 index 0000000..8644cec --- /dev/null +++ b/models/invitems.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvItem(db *gorm.DB, opts ...gen.DOOption) invItem { + _invItem := invItem{} + + _invItem.invItemDo.UseDB(db, opts...) + _invItem.invItemDo.UseModel(&models.InvItem{}) + + tableName := _invItem.invItemDo.TableName() + _invItem.ALL = field.NewAsterisk(tableName) + _invItem.ItemID = field.NewInt32(tableName, "itemID") + _invItem.TypeID = field.NewInt32(tableName, "typeID") + _invItem.OwnerID = field.NewInt32(tableName, "ownerID") + _invItem.LocationID = field.NewInt32(tableName, "locationID") + _invItem.FlagID = field.NewInt32(tableName, "flagID") + _invItem.Quantity = field.NewInt32(tableName, "quantity") + + _invItem.fillFieldMap() + + return _invItem +} + +type invItem struct { + invItemDo invItemDo + + ALL field.Asterisk + ItemID field.Int32 + TypeID field.Int32 + OwnerID field.Int32 + LocationID field.Int32 + FlagID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invItem) Table(newTableName string) *invItem { + i.invItemDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invItem) As(alias string) *invItem { + i.invItemDo.DO = *(i.invItemDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invItem) updateTableName(table string) *invItem { + i.ALL = field.NewAsterisk(table) + i.ItemID = field.NewInt32(table, "itemID") + i.TypeID = field.NewInt32(table, "typeID") + i.OwnerID = field.NewInt32(table, "ownerID") + i.LocationID = field.NewInt32(table, "locationID") + i.FlagID = field.NewInt32(table, "flagID") + i.Quantity = field.NewInt32(table, "quantity") + + i.fillFieldMap() + + return i +} + +func (i *invItem) WithContext(ctx context.Context) *invItemDo { return i.invItemDo.WithContext(ctx) } + +func (i invItem) TableName() string { return i.invItemDo.TableName() } + +func (i invItem) Alias() string { return i.invItemDo.Alias() } + +func (i invItem) Columns(cols ...field.Expr) gen.Columns { return i.invItemDo.Columns(cols...) } + +func (i *invItem) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invItem) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["itemID"] = i.ItemID + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["ownerID"] = i.OwnerID + i.fieldMap["locationID"] = i.LocationID + i.fieldMap["flagID"] = i.FlagID + i.fieldMap["quantity"] = i.Quantity +} + +func (i invItem) clone(db *gorm.DB) invItem { + i.invItemDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invItem) replaceDB(db *gorm.DB) invItem { + i.invItemDo.ReplaceDB(db) + return i +} + +type invItemDo struct{ gen.DO } + +func (i invItemDo) Debug() *invItemDo { + return i.withDO(i.DO.Debug()) +} + +func (i invItemDo) WithContext(ctx context.Context) *invItemDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invItemDo) ReadDB() *invItemDo { + return i.Clauses(dbresolver.Read) +} + +func (i invItemDo) WriteDB() *invItemDo { + return i.Clauses(dbresolver.Write) +} + +func (i invItemDo) Session(config *gorm.Session) *invItemDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invItemDo) Clauses(conds ...clause.Expression) *invItemDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invItemDo) Returning(value interface{}, columns ...string) *invItemDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invItemDo) Not(conds ...gen.Condition) *invItemDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invItemDo) Or(conds ...gen.Condition) *invItemDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invItemDo) Select(conds ...field.Expr) *invItemDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invItemDo) Where(conds ...gen.Condition) *invItemDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invItemDo) Order(conds ...field.Expr) *invItemDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invItemDo) Distinct(cols ...field.Expr) *invItemDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invItemDo) Omit(cols ...field.Expr) *invItemDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invItemDo) Join(table schema.Tabler, on ...field.Expr) *invItemDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invItemDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invItemDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invItemDo) RightJoin(table schema.Tabler, on ...field.Expr) *invItemDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invItemDo) Group(cols ...field.Expr) *invItemDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invItemDo) Having(conds ...gen.Condition) *invItemDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invItemDo) Limit(limit int) *invItemDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invItemDo) Offset(offset int) *invItemDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invItemDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invItemDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invItemDo) Unscoped() *invItemDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invItemDo) Create(values ...*models.InvItem) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invItemDo) CreateInBatches(values []*models.InvItem, batchSize int) error { + return i.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 (i invItemDo) Save(values ...*models.InvItem) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invItemDo) First() (*models.InvItem, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvItem), nil + } +} + +func (i invItemDo) Take() (*models.InvItem, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvItem), nil + } +} + +func (i invItemDo) Last() (*models.InvItem, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvItem), nil + } +} + +func (i invItemDo) Find() ([]*models.InvItem, error) { + result, err := i.DO.Find() + return result.([]*models.InvItem), err +} + +func (i invItemDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvItem, err error) { + buf := make([]*models.InvItem, 0, batchSize) + err = i.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 (i invItemDo) FindInBatches(result *[]*models.InvItem, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invItemDo) Attrs(attrs ...field.AssignExpr) *invItemDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invItemDo) Assign(attrs ...field.AssignExpr) *invItemDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invItemDo) Joins(fields ...field.RelationField) *invItemDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invItemDo) Preload(fields ...field.RelationField) *invItemDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invItemDo) FirstOrInit() (*models.InvItem, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvItem), nil + } +} + +func (i invItemDo) FirstOrCreate() (*models.InvItem, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvItem), nil + } +} + +func (i invItemDo) FindByPage(offset int, limit int) (result []*models.InvItem, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invItemDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invItemDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invItemDo) Delete(models ...*models.InvItem) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invItemDo) withDO(do gen.Dao) *invItemDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invmarketgroups.gen.go b/models/invmarketgroups.gen.go new file mode 100644 index 0000000..457f596 --- /dev/null +++ b/models/invmarketgroups.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvMarketGroup(db *gorm.DB, opts ...gen.DOOption) invMarketGroup { + _invMarketGroup := invMarketGroup{} + + _invMarketGroup.invMarketGroupDo.UseDB(db, opts...) + _invMarketGroup.invMarketGroupDo.UseModel(&models.InvMarketGroup{}) + + tableName := _invMarketGroup.invMarketGroupDo.TableName() + _invMarketGroup.ALL = field.NewAsterisk(tableName) + _invMarketGroup.MarketGroupID = field.NewInt32(tableName, "marketGroupID") + _invMarketGroup.ParentGroupID = field.NewInt32(tableName, "parentGroupID") + _invMarketGroup.MarketGroupName = field.NewString(tableName, "marketGroupName") + _invMarketGroup.Description = field.NewString(tableName, "description") + _invMarketGroup.IconID = field.NewInt32(tableName, "iconID") + _invMarketGroup.HasTypes = field.NewBool(tableName, "hasTypes") + + _invMarketGroup.fillFieldMap() + + return _invMarketGroup +} + +type invMarketGroup struct { + invMarketGroupDo invMarketGroupDo + + ALL field.Asterisk + MarketGroupID field.Int32 + ParentGroupID field.Int32 + MarketGroupName field.String + Description field.String + IconID field.Int32 + HasTypes field.Bool + + fieldMap map[string]field.Expr +} + +func (i invMarketGroup) Table(newTableName string) *invMarketGroup { + i.invMarketGroupDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invMarketGroup) As(alias string) *invMarketGroup { + i.invMarketGroupDo.DO = *(i.invMarketGroupDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invMarketGroup) updateTableName(table string) *invMarketGroup { + i.ALL = field.NewAsterisk(table) + i.MarketGroupID = field.NewInt32(table, "marketGroupID") + i.ParentGroupID = field.NewInt32(table, "parentGroupID") + i.MarketGroupName = field.NewString(table, "marketGroupName") + i.Description = field.NewString(table, "description") + i.IconID = field.NewInt32(table, "iconID") + i.HasTypes = field.NewBool(table, "hasTypes") + + i.fillFieldMap() + + return i +} + +func (i *invMarketGroup) WithContext(ctx context.Context) *invMarketGroupDo { + return i.invMarketGroupDo.WithContext(ctx) +} + +func (i invMarketGroup) TableName() string { return i.invMarketGroupDo.TableName() } + +func (i invMarketGroup) Alias() string { return i.invMarketGroupDo.Alias() } + +func (i invMarketGroup) Columns(cols ...field.Expr) gen.Columns { + return i.invMarketGroupDo.Columns(cols...) +} + +func (i *invMarketGroup) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invMarketGroup) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["marketGroupID"] = i.MarketGroupID + i.fieldMap["parentGroupID"] = i.ParentGroupID + i.fieldMap["marketGroupName"] = i.MarketGroupName + i.fieldMap["description"] = i.Description + i.fieldMap["iconID"] = i.IconID + i.fieldMap["hasTypes"] = i.HasTypes +} + +func (i invMarketGroup) clone(db *gorm.DB) invMarketGroup { + i.invMarketGroupDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invMarketGroup) replaceDB(db *gorm.DB) invMarketGroup { + i.invMarketGroupDo.ReplaceDB(db) + return i +} + +type invMarketGroupDo struct{ gen.DO } + +func (i invMarketGroupDo) Debug() *invMarketGroupDo { + return i.withDO(i.DO.Debug()) +} + +func (i invMarketGroupDo) WithContext(ctx context.Context) *invMarketGroupDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invMarketGroupDo) ReadDB() *invMarketGroupDo { + return i.Clauses(dbresolver.Read) +} + +func (i invMarketGroupDo) WriteDB() *invMarketGroupDo { + return i.Clauses(dbresolver.Write) +} + +func (i invMarketGroupDo) Session(config *gorm.Session) *invMarketGroupDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invMarketGroupDo) Clauses(conds ...clause.Expression) *invMarketGroupDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invMarketGroupDo) Returning(value interface{}, columns ...string) *invMarketGroupDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invMarketGroupDo) Not(conds ...gen.Condition) *invMarketGroupDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invMarketGroupDo) Or(conds ...gen.Condition) *invMarketGroupDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invMarketGroupDo) Select(conds ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invMarketGroupDo) Where(conds ...gen.Condition) *invMarketGroupDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invMarketGroupDo) Order(conds ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invMarketGroupDo) Distinct(cols ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invMarketGroupDo) Omit(cols ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invMarketGroupDo) Join(table schema.Tabler, on ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invMarketGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invMarketGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invMarketGroupDo) Group(cols ...field.Expr) *invMarketGroupDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invMarketGroupDo) Having(conds ...gen.Condition) *invMarketGroupDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invMarketGroupDo) Limit(limit int) *invMarketGroupDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invMarketGroupDo) Offset(offset int) *invMarketGroupDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invMarketGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invMarketGroupDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invMarketGroupDo) Unscoped() *invMarketGroupDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invMarketGroupDo) Create(values ...*models.InvMarketGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invMarketGroupDo) CreateInBatches(values []*models.InvMarketGroup, batchSize int) error { + return i.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 (i invMarketGroupDo) Save(values ...*models.InvMarketGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invMarketGroupDo) First() (*models.InvMarketGroup, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvMarketGroup), nil + } +} + +func (i invMarketGroupDo) Take() (*models.InvMarketGroup, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvMarketGroup), nil + } +} + +func (i invMarketGroupDo) Last() (*models.InvMarketGroup, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvMarketGroup), nil + } +} + +func (i invMarketGroupDo) Find() ([]*models.InvMarketGroup, error) { + result, err := i.DO.Find() + return result.([]*models.InvMarketGroup), err +} + +func (i invMarketGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvMarketGroup, err error) { + buf := make([]*models.InvMarketGroup, 0, batchSize) + err = i.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 (i invMarketGroupDo) FindInBatches(result *[]*models.InvMarketGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invMarketGroupDo) Attrs(attrs ...field.AssignExpr) *invMarketGroupDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invMarketGroupDo) Assign(attrs ...field.AssignExpr) *invMarketGroupDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invMarketGroupDo) Joins(fields ...field.RelationField) *invMarketGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invMarketGroupDo) Preload(fields ...field.RelationField) *invMarketGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invMarketGroupDo) FirstOrInit() (*models.InvMarketGroup, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvMarketGroup), nil + } +} + +func (i invMarketGroupDo) FirstOrCreate() (*models.InvMarketGroup, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvMarketGroup), nil + } +} + +func (i invMarketGroupDo) FindByPage(offset int, limit int) (result []*models.InvMarketGroup, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invMarketGroupDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invMarketGroupDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invMarketGroupDo) Delete(models ...*models.InvMarketGroup) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invMarketGroupDo) withDO(do gen.Dao) *invMarketGroupDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invmetagroups.gen.go b/models/invmetagroups.gen.go new file mode 100644 index 0000000..682a637 --- /dev/null +++ b/models/invmetagroups.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvMetaGroup(db *gorm.DB, opts ...gen.DOOption) invMetaGroup { + _invMetaGroup := invMetaGroup{} + + _invMetaGroup.invMetaGroupDo.UseDB(db, opts...) + _invMetaGroup.invMetaGroupDo.UseModel(&models.InvMetaGroup{}) + + tableName := _invMetaGroup.invMetaGroupDo.TableName() + _invMetaGroup.ALL = field.NewAsterisk(tableName) + _invMetaGroup.MetaGroupID = field.NewInt32(tableName, "metaGroupID") + _invMetaGroup.MetaGroupName = field.NewString(tableName, "metaGroupName") + _invMetaGroup.Description = field.NewString(tableName, "description") + _invMetaGroup.IconID = field.NewInt32(tableName, "iconID") + + _invMetaGroup.fillFieldMap() + + return _invMetaGroup +} + +type invMetaGroup struct { + invMetaGroupDo invMetaGroupDo + + ALL field.Asterisk + MetaGroupID field.Int32 + MetaGroupName field.String + Description field.String + IconID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invMetaGroup) Table(newTableName string) *invMetaGroup { + i.invMetaGroupDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invMetaGroup) As(alias string) *invMetaGroup { + i.invMetaGroupDo.DO = *(i.invMetaGroupDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invMetaGroup) updateTableName(table string) *invMetaGroup { + i.ALL = field.NewAsterisk(table) + i.MetaGroupID = field.NewInt32(table, "metaGroupID") + i.MetaGroupName = field.NewString(table, "metaGroupName") + i.Description = field.NewString(table, "description") + i.IconID = field.NewInt32(table, "iconID") + + i.fillFieldMap() + + return i +} + +func (i *invMetaGroup) WithContext(ctx context.Context) *invMetaGroupDo { + return i.invMetaGroupDo.WithContext(ctx) +} + +func (i invMetaGroup) TableName() string { return i.invMetaGroupDo.TableName() } + +func (i invMetaGroup) Alias() string { return i.invMetaGroupDo.Alias() } + +func (i invMetaGroup) Columns(cols ...field.Expr) gen.Columns { + return i.invMetaGroupDo.Columns(cols...) +} + +func (i *invMetaGroup) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invMetaGroup) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["metaGroupID"] = i.MetaGroupID + i.fieldMap["metaGroupName"] = i.MetaGroupName + i.fieldMap["description"] = i.Description + i.fieldMap["iconID"] = i.IconID +} + +func (i invMetaGroup) clone(db *gorm.DB) invMetaGroup { + i.invMetaGroupDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invMetaGroup) replaceDB(db *gorm.DB) invMetaGroup { + i.invMetaGroupDo.ReplaceDB(db) + return i +} + +type invMetaGroupDo struct{ gen.DO } + +func (i invMetaGroupDo) Debug() *invMetaGroupDo { + return i.withDO(i.DO.Debug()) +} + +func (i invMetaGroupDo) WithContext(ctx context.Context) *invMetaGroupDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invMetaGroupDo) ReadDB() *invMetaGroupDo { + return i.Clauses(dbresolver.Read) +} + +func (i invMetaGroupDo) WriteDB() *invMetaGroupDo { + return i.Clauses(dbresolver.Write) +} + +func (i invMetaGroupDo) Session(config *gorm.Session) *invMetaGroupDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invMetaGroupDo) Clauses(conds ...clause.Expression) *invMetaGroupDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invMetaGroupDo) Returning(value interface{}, columns ...string) *invMetaGroupDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invMetaGroupDo) Not(conds ...gen.Condition) *invMetaGroupDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invMetaGroupDo) Or(conds ...gen.Condition) *invMetaGroupDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invMetaGroupDo) Select(conds ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invMetaGroupDo) Where(conds ...gen.Condition) *invMetaGroupDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invMetaGroupDo) Order(conds ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invMetaGroupDo) Distinct(cols ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invMetaGroupDo) Omit(cols ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invMetaGroupDo) Join(table schema.Tabler, on ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invMetaGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invMetaGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invMetaGroupDo) Group(cols ...field.Expr) *invMetaGroupDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invMetaGroupDo) Having(conds ...gen.Condition) *invMetaGroupDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invMetaGroupDo) Limit(limit int) *invMetaGroupDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invMetaGroupDo) Offset(offset int) *invMetaGroupDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invMetaGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invMetaGroupDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invMetaGroupDo) Unscoped() *invMetaGroupDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invMetaGroupDo) Create(values ...*models.InvMetaGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invMetaGroupDo) CreateInBatches(values []*models.InvMetaGroup, batchSize int) error { + return i.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 (i invMetaGroupDo) Save(values ...*models.InvMetaGroup) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invMetaGroupDo) First() (*models.InvMetaGroup, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaGroup), nil + } +} + +func (i invMetaGroupDo) Take() (*models.InvMetaGroup, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaGroup), nil + } +} + +func (i invMetaGroupDo) Last() (*models.InvMetaGroup, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaGroup), nil + } +} + +func (i invMetaGroupDo) Find() ([]*models.InvMetaGroup, error) { + result, err := i.DO.Find() + return result.([]*models.InvMetaGroup), err +} + +func (i invMetaGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvMetaGroup, err error) { + buf := make([]*models.InvMetaGroup, 0, batchSize) + err = i.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 (i invMetaGroupDo) FindInBatches(result *[]*models.InvMetaGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invMetaGroupDo) Attrs(attrs ...field.AssignExpr) *invMetaGroupDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invMetaGroupDo) Assign(attrs ...field.AssignExpr) *invMetaGroupDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invMetaGroupDo) Joins(fields ...field.RelationField) *invMetaGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invMetaGroupDo) Preload(fields ...field.RelationField) *invMetaGroupDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invMetaGroupDo) FirstOrInit() (*models.InvMetaGroup, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaGroup), nil + } +} + +func (i invMetaGroupDo) FirstOrCreate() (*models.InvMetaGroup, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaGroup), nil + } +} + +func (i invMetaGroupDo) FindByPage(offset int, limit int) (result []*models.InvMetaGroup, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invMetaGroupDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invMetaGroupDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invMetaGroupDo) Delete(models ...*models.InvMetaGroup) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invMetaGroupDo) withDO(do gen.Dao) *invMetaGroupDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invmetatypes.gen.go b/models/invmetatypes.gen.go new file mode 100644 index 0000000..72fd11e --- /dev/null +++ b/models/invmetatypes.gen.go @@ -0,0 +1,337 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvMetaType(db *gorm.DB, opts ...gen.DOOption) invMetaType { + _invMetaType := invMetaType{} + + _invMetaType.invMetaTypeDo.UseDB(db, opts...) + _invMetaType.invMetaTypeDo.UseModel(&models.InvMetaType{}) + + tableName := _invMetaType.invMetaTypeDo.TableName() + _invMetaType.ALL = field.NewAsterisk(tableName) + _invMetaType.TypeID = field.NewInt32(tableName, "typeID") + _invMetaType.ParentTypeID = field.NewInt32(tableName, "parentTypeID") + _invMetaType.MetaGroupID = field.NewInt32(tableName, "metaGroupID") + + _invMetaType.fillFieldMap() + + return _invMetaType +} + +type invMetaType struct { + invMetaTypeDo invMetaTypeDo + + ALL field.Asterisk + TypeID field.Int32 + ParentTypeID field.Int32 + MetaGroupID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invMetaType) Table(newTableName string) *invMetaType { + i.invMetaTypeDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invMetaType) As(alias string) *invMetaType { + i.invMetaTypeDo.DO = *(i.invMetaTypeDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invMetaType) updateTableName(table string) *invMetaType { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.ParentTypeID = field.NewInt32(table, "parentTypeID") + i.MetaGroupID = field.NewInt32(table, "metaGroupID") + + i.fillFieldMap() + + return i +} + +func (i *invMetaType) WithContext(ctx context.Context) *invMetaTypeDo { + return i.invMetaTypeDo.WithContext(ctx) +} + +func (i invMetaType) TableName() string { return i.invMetaTypeDo.TableName() } + +func (i invMetaType) Alias() string { return i.invMetaTypeDo.Alias() } + +func (i invMetaType) Columns(cols ...field.Expr) gen.Columns { return i.invMetaTypeDo.Columns(cols...) } + +func (i *invMetaType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invMetaType) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 3) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["parentTypeID"] = i.ParentTypeID + i.fieldMap["metaGroupID"] = i.MetaGroupID +} + +func (i invMetaType) clone(db *gorm.DB) invMetaType { + i.invMetaTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invMetaType) replaceDB(db *gorm.DB) invMetaType { + i.invMetaTypeDo.ReplaceDB(db) + return i +} + +type invMetaTypeDo struct{ gen.DO } + +func (i invMetaTypeDo) Debug() *invMetaTypeDo { + return i.withDO(i.DO.Debug()) +} + +func (i invMetaTypeDo) WithContext(ctx context.Context) *invMetaTypeDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invMetaTypeDo) ReadDB() *invMetaTypeDo { + return i.Clauses(dbresolver.Read) +} + +func (i invMetaTypeDo) WriteDB() *invMetaTypeDo { + return i.Clauses(dbresolver.Write) +} + +func (i invMetaTypeDo) Session(config *gorm.Session) *invMetaTypeDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invMetaTypeDo) Clauses(conds ...clause.Expression) *invMetaTypeDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invMetaTypeDo) Returning(value interface{}, columns ...string) *invMetaTypeDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invMetaTypeDo) Not(conds ...gen.Condition) *invMetaTypeDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invMetaTypeDo) Or(conds ...gen.Condition) *invMetaTypeDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invMetaTypeDo) Select(conds ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invMetaTypeDo) Where(conds ...gen.Condition) *invMetaTypeDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invMetaTypeDo) Order(conds ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invMetaTypeDo) Distinct(cols ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invMetaTypeDo) Omit(cols ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invMetaTypeDo) Join(table schema.Tabler, on ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invMetaTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invMetaTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invMetaTypeDo) Group(cols ...field.Expr) *invMetaTypeDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invMetaTypeDo) Having(conds ...gen.Condition) *invMetaTypeDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invMetaTypeDo) Limit(limit int) *invMetaTypeDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invMetaTypeDo) Offset(offset int) *invMetaTypeDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invMetaTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invMetaTypeDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invMetaTypeDo) Unscoped() *invMetaTypeDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invMetaTypeDo) Create(values ...*models.InvMetaType) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invMetaTypeDo) CreateInBatches(values []*models.InvMetaType, batchSize int) error { + return i.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 (i invMetaTypeDo) Save(values ...*models.InvMetaType) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invMetaTypeDo) First() (*models.InvMetaType, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaType), nil + } +} + +func (i invMetaTypeDo) Take() (*models.InvMetaType, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaType), nil + } +} + +func (i invMetaTypeDo) Last() (*models.InvMetaType, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaType), nil + } +} + +func (i invMetaTypeDo) Find() ([]*models.InvMetaType, error) { + result, err := i.DO.Find() + return result.([]*models.InvMetaType), err +} + +func (i invMetaTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvMetaType, err error) { + buf := make([]*models.InvMetaType, 0, batchSize) + err = i.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 (i invMetaTypeDo) FindInBatches(result *[]*models.InvMetaType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invMetaTypeDo) Attrs(attrs ...field.AssignExpr) *invMetaTypeDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invMetaTypeDo) Assign(attrs ...field.AssignExpr) *invMetaTypeDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invMetaTypeDo) Joins(fields ...field.RelationField) *invMetaTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invMetaTypeDo) Preload(fields ...field.RelationField) *invMetaTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invMetaTypeDo) FirstOrInit() (*models.InvMetaType, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaType), nil + } +} + +func (i invMetaTypeDo) FirstOrCreate() (*models.InvMetaType, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvMetaType), nil + } +} + +func (i invMetaTypeDo) FindByPage(offset int, limit int) (result []*models.InvMetaType, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invMetaTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invMetaTypeDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invMetaTypeDo) Delete(models ...*models.InvMetaType) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invMetaTypeDo) withDO(do gen.Dao) *invMetaTypeDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invnames.gen.go b/models/invnames.gen.go new file mode 100644 index 0000000..0c885b4 --- /dev/null +++ b/models/invnames.gen.go @@ -0,0 +1,331 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvName(db *gorm.DB, opts ...gen.DOOption) invName { + _invName := invName{} + + _invName.invNameDo.UseDB(db, opts...) + _invName.invNameDo.UseModel(&models.InvName{}) + + tableName := _invName.invNameDo.TableName() + _invName.ALL = field.NewAsterisk(tableName) + _invName.ItemID = field.NewInt32(tableName, "itemID") + _invName.ItemName = field.NewString(tableName, "itemName") + + _invName.fillFieldMap() + + return _invName +} + +type invName struct { + invNameDo invNameDo + + ALL field.Asterisk + ItemID field.Int32 + ItemName field.String + + fieldMap map[string]field.Expr +} + +func (i invName) Table(newTableName string) *invName { + i.invNameDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invName) As(alias string) *invName { + i.invNameDo.DO = *(i.invNameDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invName) updateTableName(table string) *invName { + i.ALL = field.NewAsterisk(table) + i.ItemID = field.NewInt32(table, "itemID") + i.ItemName = field.NewString(table, "itemName") + + i.fillFieldMap() + + return i +} + +func (i *invName) WithContext(ctx context.Context) *invNameDo { return i.invNameDo.WithContext(ctx) } + +func (i invName) TableName() string { return i.invNameDo.TableName() } + +func (i invName) Alias() string { return i.invNameDo.Alias() } + +func (i invName) Columns(cols ...field.Expr) gen.Columns { return i.invNameDo.Columns(cols...) } + +func (i *invName) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invName) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 2) + i.fieldMap["itemID"] = i.ItemID + i.fieldMap["itemName"] = i.ItemName +} + +func (i invName) clone(db *gorm.DB) invName { + i.invNameDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invName) replaceDB(db *gorm.DB) invName { + i.invNameDo.ReplaceDB(db) + return i +} + +type invNameDo struct{ gen.DO } + +func (i invNameDo) Debug() *invNameDo { + return i.withDO(i.DO.Debug()) +} + +func (i invNameDo) WithContext(ctx context.Context) *invNameDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invNameDo) ReadDB() *invNameDo { + return i.Clauses(dbresolver.Read) +} + +func (i invNameDo) WriteDB() *invNameDo { + return i.Clauses(dbresolver.Write) +} + +func (i invNameDo) Session(config *gorm.Session) *invNameDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invNameDo) Clauses(conds ...clause.Expression) *invNameDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invNameDo) Returning(value interface{}, columns ...string) *invNameDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invNameDo) Not(conds ...gen.Condition) *invNameDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invNameDo) Or(conds ...gen.Condition) *invNameDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invNameDo) Select(conds ...field.Expr) *invNameDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invNameDo) Where(conds ...gen.Condition) *invNameDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invNameDo) Order(conds ...field.Expr) *invNameDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invNameDo) Distinct(cols ...field.Expr) *invNameDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invNameDo) Omit(cols ...field.Expr) *invNameDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invNameDo) Join(table schema.Tabler, on ...field.Expr) *invNameDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invNameDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invNameDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invNameDo) RightJoin(table schema.Tabler, on ...field.Expr) *invNameDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invNameDo) Group(cols ...field.Expr) *invNameDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invNameDo) Having(conds ...gen.Condition) *invNameDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invNameDo) Limit(limit int) *invNameDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invNameDo) Offset(offset int) *invNameDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invNameDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invNameDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invNameDo) Unscoped() *invNameDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invNameDo) Create(values ...*models.InvName) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invNameDo) CreateInBatches(values []*models.InvName, batchSize int) error { + return i.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 (i invNameDo) Save(values ...*models.InvName) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invNameDo) First() (*models.InvName, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvName), nil + } +} + +func (i invNameDo) Take() (*models.InvName, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvName), nil + } +} + +func (i invNameDo) Last() (*models.InvName, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvName), nil + } +} + +func (i invNameDo) Find() ([]*models.InvName, error) { + result, err := i.DO.Find() + return result.([]*models.InvName), err +} + +func (i invNameDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvName, err error) { + buf := make([]*models.InvName, 0, batchSize) + err = i.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 (i invNameDo) FindInBatches(result *[]*models.InvName, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invNameDo) Attrs(attrs ...field.AssignExpr) *invNameDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invNameDo) Assign(attrs ...field.AssignExpr) *invNameDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invNameDo) Joins(fields ...field.RelationField) *invNameDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invNameDo) Preload(fields ...field.RelationField) *invNameDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invNameDo) FirstOrInit() (*models.InvName, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvName), nil + } +} + +func (i invNameDo) FirstOrCreate() (*models.InvName, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvName), nil + } +} + +func (i invNameDo) FindByPage(offset int, limit int) (result []*models.InvName, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invNameDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invNameDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invNameDo) Delete(models ...*models.InvName) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invNameDo) withDO(do gen.Dao) *invNameDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invpositions.gen.go b/models/invpositions.gen.go new file mode 100644 index 0000000..d52be09 --- /dev/null +++ b/models/invpositions.gen.go @@ -0,0 +1,353 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvPosition(db *gorm.DB, opts ...gen.DOOption) invPosition { + _invPosition := invPosition{} + + _invPosition.invPositionDo.UseDB(db, opts...) + _invPosition.invPositionDo.UseModel(&models.InvPosition{}) + + tableName := _invPosition.invPositionDo.TableName() + _invPosition.ALL = field.NewAsterisk(tableName) + _invPosition.ItemID = field.NewInt32(tableName, "itemID") + _invPosition.X = field.NewFloat64(tableName, "x") + _invPosition.Y = field.NewFloat64(tableName, "y") + _invPosition.Z = field.NewFloat64(tableName, "z") + _invPosition.Yaw = field.NewFloat32(tableName, "yaw") + _invPosition.Pitch = field.NewFloat32(tableName, "pitch") + _invPosition.Roll = field.NewFloat32(tableName, "roll") + + _invPosition.fillFieldMap() + + return _invPosition +} + +type invPosition struct { + invPositionDo invPositionDo + + ALL field.Asterisk + ItemID field.Int32 + X field.Float64 + Y field.Float64 + Z field.Float64 + Yaw field.Float32 + Pitch field.Float32 + Roll field.Float32 + + fieldMap map[string]field.Expr +} + +func (i invPosition) Table(newTableName string) *invPosition { + i.invPositionDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invPosition) As(alias string) *invPosition { + i.invPositionDo.DO = *(i.invPositionDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invPosition) updateTableName(table string) *invPosition { + i.ALL = field.NewAsterisk(table) + i.ItemID = field.NewInt32(table, "itemID") + i.X = field.NewFloat64(table, "x") + i.Y = field.NewFloat64(table, "y") + i.Z = field.NewFloat64(table, "z") + i.Yaw = field.NewFloat32(table, "yaw") + i.Pitch = field.NewFloat32(table, "pitch") + i.Roll = field.NewFloat32(table, "roll") + + i.fillFieldMap() + + return i +} + +func (i *invPosition) WithContext(ctx context.Context) *invPositionDo { + return i.invPositionDo.WithContext(ctx) +} + +func (i invPosition) TableName() string { return i.invPositionDo.TableName() } + +func (i invPosition) Alias() string { return i.invPositionDo.Alias() } + +func (i invPosition) Columns(cols ...field.Expr) gen.Columns { return i.invPositionDo.Columns(cols...) } + +func (i *invPosition) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invPosition) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 7) + i.fieldMap["itemID"] = i.ItemID + i.fieldMap["x"] = i.X + i.fieldMap["y"] = i.Y + i.fieldMap["z"] = i.Z + i.fieldMap["yaw"] = i.Yaw + i.fieldMap["pitch"] = i.Pitch + i.fieldMap["roll"] = i.Roll +} + +func (i invPosition) clone(db *gorm.DB) invPosition { + i.invPositionDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invPosition) replaceDB(db *gorm.DB) invPosition { + i.invPositionDo.ReplaceDB(db) + return i +} + +type invPositionDo struct{ gen.DO } + +func (i invPositionDo) Debug() *invPositionDo { + return i.withDO(i.DO.Debug()) +} + +func (i invPositionDo) WithContext(ctx context.Context) *invPositionDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invPositionDo) ReadDB() *invPositionDo { + return i.Clauses(dbresolver.Read) +} + +func (i invPositionDo) WriteDB() *invPositionDo { + return i.Clauses(dbresolver.Write) +} + +func (i invPositionDo) Session(config *gorm.Session) *invPositionDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invPositionDo) Clauses(conds ...clause.Expression) *invPositionDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invPositionDo) Returning(value interface{}, columns ...string) *invPositionDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invPositionDo) Not(conds ...gen.Condition) *invPositionDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invPositionDo) Or(conds ...gen.Condition) *invPositionDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invPositionDo) Select(conds ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invPositionDo) Where(conds ...gen.Condition) *invPositionDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invPositionDo) Order(conds ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invPositionDo) Distinct(cols ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invPositionDo) Omit(cols ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invPositionDo) Join(table schema.Tabler, on ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invPositionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invPositionDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invPositionDo) RightJoin(table schema.Tabler, on ...field.Expr) *invPositionDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invPositionDo) Group(cols ...field.Expr) *invPositionDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invPositionDo) Having(conds ...gen.Condition) *invPositionDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invPositionDo) Limit(limit int) *invPositionDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invPositionDo) Offset(offset int) *invPositionDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invPositionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invPositionDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invPositionDo) Unscoped() *invPositionDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invPositionDo) Create(values ...*models.InvPosition) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invPositionDo) CreateInBatches(values []*models.InvPosition, batchSize int) error { + return i.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 (i invPositionDo) Save(values ...*models.InvPosition) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invPositionDo) First() (*models.InvPosition, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvPosition), nil + } +} + +func (i invPositionDo) Take() (*models.InvPosition, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvPosition), nil + } +} + +func (i invPositionDo) Last() (*models.InvPosition, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvPosition), nil + } +} + +func (i invPositionDo) Find() ([]*models.InvPosition, error) { + result, err := i.DO.Find() + return result.([]*models.InvPosition), err +} + +func (i invPositionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvPosition, err error) { + buf := make([]*models.InvPosition, 0, batchSize) + err = i.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 (i invPositionDo) FindInBatches(result *[]*models.InvPosition, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invPositionDo) Attrs(attrs ...field.AssignExpr) *invPositionDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invPositionDo) Assign(attrs ...field.AssignExpr) *invPositionDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invPositionDo) Joins(fields ...field.RelationField) *invPositionDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invPositionDo) Preload(fields ...field.RelationField) *invPositionDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invPositionDo) FirstOrInit() (*models.InvPosition, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvPosition), nil + } +} + +func (i invPositionDo) FirstOrCreate() (*models.InvPosition, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvPosition), nil + } +} + +func (i invPositionDo) FindByPage(offset int, limit int) (result []*models.InvPosition, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invPositionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invPositionDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invPositionDo) Delete(models ...*models.InvPosition) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invPositionDo) withDO(do gen.Dao) *invPositionDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invtraits.gen.go b/models/invtraits.gen.go new file mode 100644 index 0000000..96e7efa --- /dev/null +++ b/models/invtraits.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvTrait(db *gorm.DB, opts ...gen.DOOption) invTrait { + _invTrait := invTrait{} + + _invTrait.invTraitDo.UseDB(db, opts...) + _invTrait.invTraitDo.UseModel(&models.InvTrait{}) + + tableName := _invTrait.invTraitDo.TableName() + _invTrait.ALL = field.NewAsterisk(tableName) + _invTrait.TraitID = field.NewInt32(tableName, "traitID") + _invTrait.TypeID = field.NewInt32(tableName, "typeID") + _invTrait.SkillID = field.NewInt32(tableName, "skillID") + _invTrait.Bonus = field.NewFloat64(tableName, "bonus") + _invTrait.BonusText = field.NewString(tableName, "bonusText") + _invTrait.UnitID = field.NewInt32(tableName, "unitID") + + _invTrait.fillFieldMap() + + return _invTrait +} + +type invTrait struct { + invTraitDo invTraitDo + + ALL field.Asterisk + TraitID field.Int32 + TypeID field.Int32 + SkillID field.Int32 + Bonus field.Float64 + BonusText field.String + UnitID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invTrait) Table(newTableName string) *invTrait { + i.invTraitDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invTrait) As(alias string) *invTrait { + i.invTraitDo.DO = *(i.invTraitDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invTrait) updateTableName(table string) *invTrait { + i.ALL = field.NewAsterisk(table) + i.TraitID = field.NewInt32(table, "traitID") + i.TypeID = field.NewInt32(table, "typeID") + i.SkillID = field.NewInt32(table, "skillID") + i.Bonus = field.NewFloat64(table, "bonus") + i.BonusText = field.NewString(table, "bonusText") + i.UnitID = field.NewInt32(table, "unitID") + + i.fillFieldMap() + + return i +} + +func (i *invTrait) WithContext(ctx context.Context) *invTraitDo { return i.invTraitDo.WithContext(ctx) } + +func (i invTrait) TableName() string { return i.invTraitDo.TableName() } + +func (i invTrait) Alias() string { return i.invTraitDo.Alias() } + +func (i invTrait) Columns(cols ...field.Expr) gen.Columns { return i.invTraitDo.Columns(cols...) } + +func (i *invTrait) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invTrait) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["traitID"] = i.TraitID + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["skillID"] = i.SkillID + i.fieldMap["bonus"] = i.Bonus + i.fieldMap["bonusText"] = i.BonusText + i.fieldMap["unitID"] = i.UnitID +} + +func (i invTrait) clone(db *gorm.DB) invTrait { + i.invTraitDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invTrait) replaceDB(db *gorm.DB) invTrait { + i.invTraitDo.ReplaceDB(db) + return i +} + +type invTraitDo struct{ gen.DO } + +func (i invTraitDo) Debug() *invTraitDo { + return i.withDO(i.DO.Debug()) +} + +func (i invTraitDo) WithContext(ctx context.Context) *invTraitDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invTraitDo) ReadDB() *invTraitDo { + return i.Clauses(dbresolver.Read) +} + +func (i invTraitDo) WriteDB() *invTraitDo { + return i.Clauses(dbresolver.Write) +} + +func (i invTraitDo) Session(config *gorm.Session) *invTraitDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invTraitDo) Clauses(conds ...clause.Expression) *invTraitDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invTraitDo) Returning(value interface{}, columns ...string) *invTraitDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invTraitDo) Not(conds ...gen.Condition) *invTraitDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invTraitDo) Or(conds ...gen.Condition) *invTraitDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invTraitDo) Select(conds ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invTraitDo) Where(conds ...gen.Condition) *invTraitDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invTraitDo) Order(conds ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invTraitDo) Distinct(cols ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invTraitDo) Omit(cols ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invTraitDo) Join(table schema.Tabler, on ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invTraitDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invTraitDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invTraitDo) RightJoin(table schema.Tabler, on ...field.Expr) *invTraitDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invTraitDo) Group(cols ...field.Expr) *invTraitDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invTraitDo) Having(conds ...gen.Condition) *invTraitDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invTraitDo) Limit(limit int) *invTraitDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invTraitDo) Offset(offset int) *invTraitDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invTraitDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invTraitDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invTraitDo) Unscoped() *invTraitDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invTraitDo) Create(values ...*models.InvTrait) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invTraitDo) CreateInBatches(values []*models.InvTrait, batchSize int) error { + return i.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 (i invTraitDo) Save(values ...*models.InvTrait) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invTraitDo) First() (*models.InvTrait, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvTrait), nil + } +} + +func (i invTraitDo) Take() (*models.InvTrait, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvTrait), nil + } +} + +func (i invTraitDo) Last() (*models.InvTrait, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvTrait), nil + } +} + +func (i invTraitDo) Find() ([]*models.InvTrait, error) { + result, err := i.DO.Find() + return result.([]*models.InvTrait), err +} + +func (i invTraitDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvTrait, err error) { + buf := make([]*models.InvTrait, 0, batchSize) + err = i.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 (i invTraitDo) FindInBatches(result *[]*models.InvTrait, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invTraitDo) Attrs(attrs ...field.AssignExpr) *invTraitDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invTraitDo) Assign(attrs ...field.AssignExpr) *invTraitDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invTraitDo) Joins(fields ...field.RelationField) *invTraitDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invTraitDo) Preload(fields ...field.RelationField) *invTraitDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invTraitDo) FirstOrInit() (*models.InvTrait, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvTrait), nil + } +} + +func (i invTraitDo) FirstOrCreate() (*models.InvTrait, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvTrait), nil + } +} + +func (i invTraitDo) FindByPage(offset int, limit int) (result []*models.InvTrait, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invTraitDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invTraitDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invTraitDo) Delete(models ...*models.InvTrait) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invTraitDo) withDO(do gen.Dao) *invTraitDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invtypematerials.gen.go b/models/invtypematerials.gen.go new file mode 100644 index 0000000..6d28cda --- /dev/null +++ b/models/invtypematerials.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvTypeMaterial(db *gorm.DB, opts ...gen.DOOption) invTypeMaterial { + _invTypeMaterial := invTypeMaterial{} + + _invTypeMaterial.invTypeMaterialDo.UseDB(db, opts...) + _invTypeMaterial.invTypeMaterialDo.UseModel(&models.InvTypeMaterial{}) + + tableName := _invTypeMaterial.invTypeMaterialDo.TableName() + _invTypeMaterial.ALL = field.NewAsterisk(tableName) + _invTypeMaterial.TypeID = field.NewInt32(tableName, "typeID") + _invTypeMaterial.MaterialTypeID = field.NewInt32(tableName, "materialTypeID") + _invTypeMaterial.Quantity = field.NewInt32(tableName, "quantity") + + _invTypeMaterial.fillFieldMap() + + return _invTypeMaterial +} + +type invTypeMaterial struct { + invTypeMaterialDo invTypeMaterialDo + + ALL field.Asterisk + TypeID field.Int32 + MaterialTypeID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invTypeMaterial) Table(newTableName string) *invTypeMaterial { + i.invTypeMaterialDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invTypeMaterial) As(alias string) *invTypeMaterial { + i.invTypeMaterialDo.DO = *(i.invTypeMaterialDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invTypeMaterial) updateTableName(table string) *invTypeMaterial { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.MaterialTypeID = field.NewInt32(table, "materialTypeID") + i.Quantity = field.NewInt32(table, "quantity") + + i.fillFieldMap() + + return i +} + +func (i *invTypeMaterial) WithContext(ctx context.Context) *invTypeMaterialDo { + return i.invTypeMaterialDo.WithContext(ctx) +} + +func (i invTypeMaterial) TableName() string { return i.invTypeMaterialDo.TableName() } + +func (i invTypeMaterial) Alias() string { return i.invTypeMaterialDo.Alias() } + +func (i invTypeMaterial) Columns(cols ...field.Expr) gen.Columns { + return i.invTypeMaterialDo.Columns(cols...) +} + +func (i *invTypeMaterial) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invTypeMaterial) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 3) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["materialTypeID"] = i.MaterialTypeID + i.fieldMap["quantity"] = i.Quantity +} + +func (i invTypeMaterial) clone(db *gorm.DB) invTypeMaterial { + i.invTypeMaterialDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invTypeMaterial) replaceDB(db *gorm.DB) invTypeMaterial { + i.invTypeMaterialDo.ReplaceDB(db) + return i +} + +type invTypeMaterialDo struct{ gen.DO } + +func (i invTypeMaterialDo) Debug() *invTypeMaterialDo { + return i.withDO(i.DO.Debug()) +} + +func (i invTypeMaterialDo) WithContext(ctx context.Context) *invTypeMaterialDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invTypeMaterialDo) ReadDB() *invTypeMaterialDo { + return i.Clauses(dbresolver.Read) +} + +func (i invTypeMaterialDo) WriteDB() *invTypeMaterialDo { + return i.Clauses(dbresolver.Write) +} + +func (i invTypeMaterialDo) Session(config *gorm.Session) *invTypeMaterialDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invTypeMaterialDo) Clauses(conds ...clause.Expression) *invTypeMaterialDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invTypeMaterialDo) Returning(value interface{}, columns ...string) *invTypeMaterialDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invTypeMaterialDo) Not(conds ...gen.Condition) *invTypeMaterialDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invTypeMaterialDo) Or(conds ...gen.Condition) *invTypeMaterialDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invTypeMaterialDo) Select(conds ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invTypeMaterialDo) Where(conds ...gen.Condition) *invTypeMaterialDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invTypeMaterialDo) Order(conds ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invTypeMaterialDo) Distinct(cols ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invTypeMaterialDo) Omit(cols ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invTypeMaterialDo) Join(table schema.Tabler, on ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invTypeMaterialDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invTypeMaterialDo) RightJoin(table schema.Tabler, on ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invTypeMaterialDo) Group(cols ...field.Expr) *invTypeMaterialDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invTypeMaterialDo) Having(conds ...gen.Condition) *invTypeMaterialDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invTypeMaterialDo) Limit(limit int) *invTypeMaterialDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invTypeMaterialDo) Offset(offset int) *invTypeMaterialDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invTypeMaterialDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invTypeMaterialDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invTypeMaterialDo) Unscoped() *invTypeMaterialDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invTypeMaterialDo) Create(values ...*models.InvTypeMaterial) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invTypeMaterialDo) CreateInBatches(values []*models.InvTypeMaterial, batchSize int) error { + return i.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 (i invTypeMaterialDo) Save(values ...*models.InvTypeMaterial) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invTypeMaterialDo) First() (*models.InvTypeMaterial, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeMaterial), nil + } +} + +func (i invTypeMaterialDo) Take() (*models.InvTypeMaterial, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeMaterial), nil + } +} + +func (i invTypeMaterialDo) Last() (*models.InvTypeMaterial, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeMaterial), nil + } +} + +func (i invTypeMaterialDo) Find() ([]*models.InvTypeMaterial, error) { + result, err := i.DO.Find() + return result.([]*models.InvTypeMaterial), err +} + +func (i invTypeMaterialDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvTypeMaterial, err error) { + buf := make([]*models.InvTypeMaterial, 0, batchSize) + err = i.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 (i invTypeMaterialDo) FindInBatches(result *[]*models.InvTypeMaterial, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invTypeMaterialDo) Attrs(attrs ...field.AssignExpr) *invTypeMaterialDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invTypeMaterialDo) Assign(attrs ...field.AssignExpr) *invTypeMaterialDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invTypeMaterialDo) Joins(fields ...field.RelationField) *invTypeMaterialDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invTypeMaterialDo) Preload(fields ...field.RelationField) *invTypeMaterialDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invTypeMaterialDo) FirstOrInit() (*models.InvTypeMaterial, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeMaterial), nil + } +} + +func (i invTypeMaterialDo) FirstOrCreate() (*models.InvTypeMaterial, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeMaterial), nil + } +} + +func (i invTypeMaterialDo) FindByPage(offset int, limit int) (result []*models.InvTypeMaterial, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invTypeMaterialDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invTypeMaterialDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invTypeMaterialDo) Delete(models ...*models.InvTypeMaterial) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invTypeMaterialDo) withDO(do gen.Dao) *invTypeMaterialDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invtypereactions.gen.go b/models/invtypereactions.gen.go new file mode 100644 index 0000000..6e25fde --- /dev/null +++ b/models/invtypereactions.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvTypeReaction(db *gorm.DB, opts ...gen.DOOption) invTypeReaction { + _invTypeReaction := invTypeReaction{} + + _invTypeReaction.invTypeReactionDo.UseDB(db, opts...) + _invTypeReaction.invTypeReactionDo.UseModel(&models.InvTypeReaction{}) + + tableName := _invTypeReaction.invTypeReactionDo.TableName() + _invTypeReaction.ALL = field.NewAsterisk(tableName) + _invTypeReaction.ReactionTypeID = field.NewInt32(tableName, "reactionTypeID") + _invTypeReaction.Input = field.NewBool(tableName, "input") + _invTypeReaction.TypeID = field.NewInt32(tableName, "typeID") + _invTypeReaction.Quantity = field.NewInt32(tableName, "quantity") + + _invTypeReaction.fillFieldMap() + + return _invTypeReaction +} + +type invTypeReaction struct { + invTypeReactionDo invTypeReactionDo + + ALL field.Asterisk + ReactionTypeID field.Int32 + Input field.Bool + TypeID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invTypeReaction) Table(newTableName string) *invTypeReaction { + i.invTypeReactionDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invTypeReaction) As(alias string) *invTypeReaction { + i.invTypeReactionDo.DO = *(i.invTypeReactionDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invTypeReaction) updateTableName(table string) *invTypeReaction { + i.ALL = field.NewAsterisk(table) + i.ReactionTypeID = field.NewInt32(table, "reactionTypeID") + i.Input = field.NewBool(table, "input") + i.TypeID = field.NewInt32(table, "typeID") + i.Quantity = field.NewInt32(table, "quantity") + + i.fillFieldMap() + + return i +} + +func (i *invTypeReaction) WithContext(ctx context.Context) *invTypeReactionDo { + return i.invTypeReactionDo.WithContext(ctx) +} + +func (i invTypeReaction) TableName() string { return i.invTypeReactionDo.TableName() } + +func (i invTypeReaction) Alias() string { return i.invTypeReactionDo.Alias() } + +func (i invTypeReaction) Columns(cols ...field.Expr) gen.Columns { + return i.invTypeReactionDo.Columns(cols...) +} + +func (i *invTypeReaction) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invTypeReaction) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["reactionTypeID"] = i.ReactionTypeID + i.fieldMap["input"] = i.Input + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["quantity"] = i.Quantity +} + +func (i invTypeReaction) clone(db *gorm.DB) invTypeReaction { + i.invTypeReactionDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invTypeReaction) replaceDB(db *gorm.DB) invTypeReaction { + i.invTypeReactionDo.ReplaceDB(db) + return i +} + +type invTypeReactionDo struct{ gen.DO } + +func (i invTypeReactionDo) Debug() *invTypeReactionDo { + return i.withDO(i.DO.Debug()) +} + +func (i invTypeReactionDo) WithContext(ctx context.Context) *invTypeReactionDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invTypeReactionDo) ReadDB() *invTypeReactionDo { + return i.Clauses(dbresolver.Read) +} + +func (i invTypeReactionDo) WriteDB() *invTypeReactionDo { + return i.Clauses(dbresolver.Write) +} + +func (i invTypeReactionDo) Session(config *gorm.Session) *invTypeReactionDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invTypeReactionDo) Clauses(conds ...clause.Expression) *invTypeReactionDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invTypeReactionDo) Returning(value interface{}, columns ...string) *invTypeReactionDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invTypeReactionDo) Not(conds ...gen.Condition) *invTypeReactionDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invTypeReactionDo) Or(conds ...gen.Condition) *invTypeReactionDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invTypeReactionDo) Select(conds ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invTypeReactionDo) Where(conds ...gen.Condition) *invTypeReactionDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invTypeReactionDo) Order(conds ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invTypeReactionDo) Distinct(cols ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invTypeReactionDo) Omit(cols ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invTypeReactionDo) Join(table schema.Tabler, on ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invTypeReactionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invTypeReactionDo) RightJoin(table schema.Tabler, on ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invTypeReactionDo) Group(cols ...field.Expr) *invTypeReactionDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invTypeReactionDo) Having(conds ...gen.Condition) *invTypeReactionDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invTypeReactionDo) Limit(limit int) *invTypeReactionDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invTypeReactionDo) Offset(offset int) *invTypeReactionDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invTypeReactionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invTypeReactionDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invTypeReactionDo) Unscoped() *invTypeReactionDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invTypeReactionDo) Create(values ...*models.InvTypeReaction) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invTypeReactionDo) CreateInBatches(values []*models.InvTypeReaction, batchSize int) error { + return i.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 (i invTypeReactionDo) Save(values ...*models.InvTypeReaction) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invTypeReactionDo) First() (*models.InvTypeReaction, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeReaction), nil + } +} + +func (i invTypeReactionDo) Take() (*models.InvTypeReaction, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeReaction), nil + } +} + +func (i invTypeReactionDo) Last() (*models.InvTypeReaction, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeReaction), nil + } +} + +func (i invTypeReactionDo) Find() ([]*models.InvTypeReaction, error) { + result, err := i.DO.Find() + return result.([]*models.InvTypeReaction), err +} + +func (i invTypeReactionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvTypeReaction, err error) { + buf := make([]*models.InvTypeReaction, 0, batchSize) + err = i.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 (i invTypeReactionDo) FindInBatches(result *[]*models.InvTypeReaction, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invTypeReactionDo) Attrs(attrs ...field.AssignExpr) *invTypeReactionDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invTypeReactionDo) Assign(attrs ...field.AssignExpr) *invTypeReactionDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invTypeReactionDo) Joins(fields ...field.RelationField) *invTypeReactionDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invTypeReactionDo) Preload(fields ...field.RelationField) *invTypeReactionDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invTypeReactionDo) FirstOrInit() (*models.InvTypeReaction, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeReaction), nil + } +} + +func (i invTypeReactionDo) FirstOrCreate() (*models.InvTypeReaction, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvTypeReaction), nil + } +} + +func (i invTypeReactionDo) FindByPage(offset int, limit int) (result []*models.InvTypeReaction, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invTypeReactionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invTypeReactionDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invTypeReactionDo) Delete(models ...*models.InvTypeReaction) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invTypeReactionDo) withDO(do gen.Dao) *invTypeReactionDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invtypes.gen.go b/models/invtypes.gen.go new file mode 100644 index 0000000..b4e10db --- /dev/null +++ b/models/invtypes.gen.go @@ -0,0 +1,383 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvType(db *gorm.DB, opts ...gen.DOOption) invType { + _invType := invType{} + + _invType.invTypeDo.UseDB(db, opts...) + _invType.invTypeDo.UseModel(&models.InvType{}) + + tableName := _invType.invTypeDo.TableName() + _invType.ALL = field.NewAsterisk(tableName) + _invType.TypeID = field.NewInt32(tableName, "typeID") + _invType.GroupID = field.NewInt32(tableName, "groupID") + _invType.TypeName = field.NewString(tableName, "typeName") + _invType.Description = field.NewString(tableName, "description") + _invType.Mass = field.NewFloat64(tableName, "mass") + _invType.Volume = field.NewFloat64(tableName, "volume") + _invType.Capacity = field.NewFloat64(tableName, "capacity") + _invType.PortionSize = field.NewInt32(tableName, "portionSize") + _invType.RaceID = field.NewInt32(tableName, "raceID") + _invType.BasePrice = field.NewFloat64(tableName, "basePrice") + _invType.Published = field.NewBool(tableName, "published") + _invType.MarketGroupID = field.NewInt32(tableName, "marketGroupID") + _invType.IconID = field.NewInt32(tableName, "iconID") + _invType.SoundID = field.NewInt32(tableName, "soundID") + _invType.GraphicID = field.NewInt32(tableName, "graphicID") + + _invType.fillFieldMap() + + return _invType +} + +type invType struct { + invTypeDo invTypeDo + + ALL field.Asterisk + TypeID field.Int32 + GroupID field.Int32 + TypeName field.String + Description field.String + Mass field.Float64 + Volume field.Float64 + Capacity field.Float64 + PortionSize field.Int32 + RaceID field.Int32 + BasePrice field.Float64 + Published field.Bool + MarketGroupID field.Int32 + IconID field.Int32 + SoundID field.Int32 + GraphicID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invType) Table(newTableName string) *invType { + i.invTypeDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invType) As(alias string) *invType { + i.invTypeDo.DO = *(i.invTypeDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invType) updateTableName(table string) *invType { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.GroupID = field.NewInt32(table, "groupID") + i.TypeName = field.NewString(table, "typeName") + i.Description = field.NewString(table, "description") + i.Mass = field.NewFloat64(table, "mass") + i.Volume = field.NewFloat64(table, "volume") + i.Capacity = field.NewFloat64(table, "capacity") + i.PortionSize = field.NewInt32(table, "portionSize") + i.RaceID = field.NewInt32(table, "raceID") + i.BasePrice = field.NewFloat64(table, "basePrice") + i.Published = field.NewBool(table, "published") + i.MarketGroupID = field.NewInt32(table, "marketGroupID") + i.IconID = field.NewInt32(table, "iconID") + i.SoundID = field.NewInt32(table, "soundID") + i.GraphicID = field.NewInt32(table, "graphicID") + + i.fillFieldMap() + + return i +} + +func (i *invType) WithContext(ctx context.Context) *invTypeDo { return i.invTypeDo.WithContext(ctx) } + +func (i invType) TableName() string { return i.invTypeDo.TableName() } + +func (i invType) Alias() string { return i.invTypeDo.Alias() } + +func (i invType) Columns(cols ...field.Expr) gen.Columns { return i.invTypeDo.Columns(cols...) } + +func (i *invType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invType) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 15) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["groupID"] = i.GroupID + i.fieldMap["typeName"] = i.TypeName + i.fieldMap["description"] = i.Description + i.fieldMap["mass"] = i.Mass + i.fieldMap["volume"] = i.Volume + i.fieldMap["capacity"] = i.Capacity + i.fieldMap["portionSize"] = i.PortionSize + i.fieldMap["raceID"] = i.RaceID + i.fieldMap["basePrice"] = i.BasePrice + i.fieldMap["published"] = i.Published + i.fieldMap["marketGroupID"] = i.MarketGroupID + i.fieldMap["iconID"] = i.IconID + i.fieldMap["soundID"] = i.SoundID + i.fieldMap["graphicID"] = i.GraphicID +} + +func (i invType) clone(db *gorm.DB) invType { + i.invTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invType) replaceDB(db *gorm.DB) invType { + i.invTypeDo.ReplaceDB(db) + return i +} + +type invTypeDo struct{ gen.DO } + +func (i invTypeDo) Debug() *invTypeDo { + return i.withDO(i.DO.Debug()) +} + +func (i invTypeDo) WithContext(ctx context.Context) *invTypeDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invTypeDo) ReadDB() *invTypeDo { + return i.Clauses(dbresolver.Read) +} + +func (i invTypeDo) WriteDB() *invTypeDo { + return i.Clauses(dbresolver.Write) +} + +func (i invTypeDo) Session(config *gorm.Session) *invTypeDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invTypeDo) Clauses(conds ...clause.Expression) *invTypeDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invTypeDo) Returning(value interface{}, columns ...string) *invTypeDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invTypeDo) Not(conds ...gen.Condition) *invTypeDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invTypeDo) Or(conds ...gen.Condition) *invTypeDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invTypeDo) Select(conds ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invTypeDo) Where(conds ...gen.Condition) *invTypeDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invTypeDo) Order(conds ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invTypeDo) Distinct(cols ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invTypeDo) Omit(cols ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invTypeDo) Join(table schema.Tabler, on ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invTypeDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *invTypeDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invTypeDo) Group(cols ...field.Expr) *invTypeDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invTypeDo) Having(conds ...gen.Condition) *invTypeDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invTypeDo) Limit(limit int) *invTypeDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invTypeDo) Offset(offset int) *invTypeDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invTypeDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invTypeDo) Unscoped() *invTypeDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invTypeDo) Create(values ...*models.InvType) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invTypeDo) CreateInBatches(values []*models.InvType, batchSize int) error { + return i.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 (i invTypeDo) Save(values ...*models.InvType) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invTypeDo) First() (*models.InvType, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvType), nil + } +} + +func (i invTypeDo) Take() (*models.InvType, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvType), nil + } +} + +func (i invTypeDo) Last() (*models.InvType, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvType), nil + } +} + +func (i invTypeDo) Find() ([]*models.InvType, error) { + result, err := i.DO.Find() + return result.([]*models.InvType), err +} + +func (i invTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvType, err error) { + buf := make([]*models.InvType, 0, batchSize) + err = i.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 (i invTypeDo) FindInBatches(result *[]*models.InvType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invTypeDo) Attrs(attrs ...field.AssignExpr) *invTypeDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invTypeDo) Assign(attrs ...field.AssignExpr) *invTypeDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invTypeDo) Joins(fields ...field.RelationField) *invTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invTypeDo) Preload(fields ...field.RelationField) *invTypeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invTypeDo) FirstOrInit() (*models.InvType, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvType), nil + } +} + +func (i invTypeDo) FirstOrCreate() (*models.InvType, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvType), nil + } +} + +func (i invTypeDo) FindByPage(offset int, limit int) (result []*models.InvType, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invTypeDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invTypeDo) Delete(models ...*models.InvType) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invTypeDo) withDO(do gen.Dao) *invTypeDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invuniquenames.gen.go b/models/invuniquenames.gen.go new file mode 100644 index 0000000..3e723fa --- /dev/null +++ b/models/invuniquenames.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvUniqueName(db *gorm.DB, opts ...gen.DOOption) invUniqueName { + _invUniqueName := invUniqueName{} + + _invUniqueName.invUniqueNameDo.UseDB(db, opts...) + _invUniqueName.invUniqueNameDo.UseModel(&models.InvUniqueName{}) + + tableName := _invUniqueName.invUniqueNameDo.TableName() + _invUniqueName.ALL = field.NewAsterisk(tableName) + _invUniqueName.ItemID = field.NewInt32(tableName, "itemID") + _invUniqueName.ItemName = field.NewString(tableName, "itemName") + _invUniqueName.GroupID = field.NewInt32(tableName, "groupID") + + _invUniqueName.fillFieldMap() + + return _invUniqueName +} + +type invUniqueName struct { + invUniqueNameDo invUniqueNameDo + + ALL field.Asterisk + ItemID field.Int32 + ItemName field.String + GroupID field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invUniqueName) Table(newTableName string) *invUniqueName { + i.invUniqueNameDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invUniqueName) As(alias string) *invUniqueName { + i.invUniqueNameDo.DO = *(i.invUniqueNameDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invUniqueName) updateTableName(table string) *invUniqueName { + i.ALL = field.NewAsterisk(table) + i.ItemID = field.NewInt32(table, "itemID") + i.ItemName = field.NewString(table, "itemName") + i.GroupID = field.NewInt32(table, "groupID") + + i.fillFieldMap() + + return i +} + +func (i *invUniqueName) WithContext(ctx context.Context) *invUniqueNameDo { + return i.invUniqueNameDo.WithContext(ctx) +} + +func (i invUniqueName) TableName() string { return i.invUniqueNameDo.TableName() } + +func (i invUniqueName) Alias() string { return i.invUniqueNameDo.Alias() } + +func (i invUniqueName) Columns(cols ...field.Expr) gen.Columns { + return i.invUniqueNameDo.Columns(cols...) +} + +func (i *invUniqueName) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invUniqueName) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 3) + i.fieldMap["itemID"] = i.ItemID + i.fieldMap["itemName"] = i.ItemName + i.fieldMap["groupID"] = i.GroupID +} + +func (i invUniqueName) clone(db *gorm.DB) invUniqueName { + i.invUniqueNameDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invUniqueName) replaceDB(db *gorm.DB) invUniqueName { + i.invUniqueNameDo.ReplaceDB(db) + return i +} + +type invUniqueNameDo struct{ gen.DO } + +func (i invUniqueNameDo) Debug() *invUniqueNameDo { + return i.withDO(i.DO.Debug()) +} + +func (i invUniqueNameDo) WithContext(ctx context.Context) *invUniqueNameDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invUniqueNameDo) ReadDB() *invUniqueNameDo { + return i.Clauses(dbresolver.Read) +} + +func (i invUniqueNameDo) WriteDB() *invUniqueNameDo { + return i.Clauses(dbresolver.Write) +} + +func (i invUniqueNameDo) Session(config *gorm.Session) *invUniqueNameDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invUniqueNameDo) Clauses(conds ...clause.Expression) *invUniqueNameDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invUniqueNameDo) Returning(value interface{}, columns ...string) *invUniqueNameDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invUniqueNameDo) Not(conds ...gen.Condition) *invUniqueNameDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invUniqueNameDo) Or(conds ...gen.Condition) *invUniqueNameDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invUniqueNameDo) Select(conds ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invUniqueNameDo) Where(conds ...gen.Condition) *invUniqueNameDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invUniqueNameDo) Order(conds ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invUniqueNameDo) Distinct(cols ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invUniqueNameDo) Omit(cols ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invUniqueNameDo) Join(table schema.Tabler, on ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invUniqueNameDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invUniqueNameDo) RightJoin(table schema.Tabler, on ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invUniqueNameDo) Group(cols ...field.Expr) *invUniqueNameDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invUniqueNameDo) Having(conds ...gen.Condition) *invUniqueNameDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invUniqueNameDo) Limit(limit int) *invUniqueNameDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invUniqueNameDo) Offset(offset int) *invUniqueNameDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invUniqueNameDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invUniqueNameDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invUniqueNameDo) Unscoped() *invUniqueNameDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invUniqueNameDo) Create(values ...*models.InvUniqueName) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invUniqueNameDo) CreateInBatches(values []*models.InvUniqueName, batchSize int) error { + return i.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 (i invUniqueNameDo) Save(values ...*models.InvUniqueName) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invUniqueNameDo) First() (*models.InvUniqueName, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvUniqueName), nil + } +} + +func (i invUniqueNameDo) Take() (*models.InvUniqueName, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvUniqueName), nil + } +} + +func (i invUniqueNameDo) Last() (*models.InvUniqueName, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvUniqueName), nil + } +} + +func (i invUniqueNameDo) Find() ([]*models.InvUniqueName, error) { + result, err := i.DO.Find() + return result.([]*models.InvUniqueName), err +} + +func (i invUniqueNameDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvUniqueName, err error) { + buf := make([]*models.InvUniqueName, 0, batchSize) + err = i.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 (i invUniqueNameDo) FindInBatches(result *[]*models.InvUniqueName, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invUniqueNameDo) Attrs(attrs ...field.AssignExpr) *invUniqueNameDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invUniqueNameDo) Assign(attrs ...field.AssignExpr) *invUniqueNameDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invUniqueNameDo) Joins(fields ...field.RelationField) *invUniqueNameDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invUniqueNameDo) Preload(fields ...field.RelationField) *invUniqueNameDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invUniqueNameDo) FirstOrInit() (*models.InvUniqueName, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvUniqueName), nil + } +} + +func (i invUniqueNameDo) FirstOrCreate() (*models.InvUniqueName, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvUniqueName), nil + } +} + +func (i invUniqueNameDo) FindByPage(offset int, limit int) (result []*models.InvUniqueName, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invUniqueNameDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invUniqueNameDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invUniqueNameDo) Delete(models ...*models.InvUniqueName) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invUniqueNameDo) withDO(do gen.Dao) *invUniqueNameDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/invvolumes.gen.go b/models/invvolumes.gen.go new file mode 100644 index 0000000..f5b5c2f --- /dev/null +++ b/models/invvolumes.gen.go @@ -0,0 +1,333 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newInvVolume(db *gorm.DB, opts ...gen.DOOption) invVolume { + _invVolume := invVolume{} + + _invVolume.invVolumeDo.UseDB(db, opts...) + _invVolume.invVolumeDo.UseModel(&models.InvVolume{}) + + tableName := _invVolume.invVolumeDo.TableName() + _invVolume.ALL = field.NewAsterisk(tableName) + _invVolume.TypeID = field.NewInt32(tableName, "typeID") + _invVolume.Volume = field.NewInt32(tableName, "volume") + + _invVolume.fillFieldMap() + + return _invVolume +} + +type invVolume struct { + invVolumeDo invVolumeDo + + ALL field.Asterisk + TypeID field.Int32 + Volume field.Int32 + + fieldMap map[string]field.Expr +} + +func (i invVolume) Table(newTableName string) *invVolume { + i.invVolumeDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invVolume) As(alias string) *invVolume { + i.invVolumeDo.DO = *(i.invVolumeDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invVolume) updateTableName(table string) *invVolume { + i.ALL = field.NewAsterisk(table) + i.TypeID = field.NewInt32(table, "typeID") + i.Volume = field.NewInt32(table, "volume") + + i.fillFieldMap() + + return i +} + +func (i *invVolume) WithContext(ctx context.Context) *invVolumeDo { + return i.invVolumeDo.WithContext(ctx) +} + +func (i invVolume) TableName() string { return i.invVolumeDo.TableName() } + +func (i invVolume) Alias() string { return i.invVolumeDo.Alias() } + +func (i invVolume) Columns(cols ...field.Expr) gen.Columns { return i.invVolumeDo.Columns(cols...) } + +func (i *invVolume) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invVolume) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 2) + i.fieldMap["typeID"] = i.TypeID + i.fieldMap["volume"] = i.Volume +} + +func (i invVolume) clone(db *gorm.DB) invVolume { + i.invVolumeDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invVolume) replaceDB(db *gorm.DB) invVolume { + i.invVolumeDo.ReplaceDB(db) + return i +} + +type invVolumeDo struct{ gen.DO } + +func (i invVolumeDo) Debug() *invVolumeDo { + return i.withDO(i.DO.Debug()) +} + +func (i invVolumeDo) WithContext(ctx context.Context) *invVolumeDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invVolumeDo) ReadDB() *invVolumeDo { + return i.Clauses(dbresolver.Read) +} + +func (i invVolumeDo) WriteDB() *invVolumeDo { + return i.Clauses(dbresolver.Write) +} + +func (i invVolumeDo) Session(config *gorm.Session) *invVolumeDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invVolumeDo) Clauses(conds ...clause.Expression) *invVolumeDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invVolumeDo) Returning(value interface{}, columns ...string) *invVolumeDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invVolumeDo) Not(conds ...gen.Condition) *invVolumeDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invVolumeDo) Or(conds ...gen.Condition) *invVolumeDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invVolumeDo) Select(conds ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invVolumeDo) Where(conds ...gen.Condition) *invVolumeDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invVolumeDo) Order(conds ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invVolumeDo) Distinct(cols ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invVolumeDo) Omit(cols ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invVolumeDo) Join(table schema.Tabler, on ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invVolumeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invVolumeDo) RightJoin(table schema.Tabler, on ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invVolumeDo) Group(cols ...field.Expr) *invVolumeDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invVolumeDo) Having(conds ...gen.Condition) *invVolumeDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invVolumeDo) Limit(limit int) *invVolumeDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invVolumeDo) Offset(offset int) *invVolumeDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invVolumeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *invVolumeDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invVolumeDo) Unscoped() *invVolumeDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invVolumeDo) Create(values ...*models.InvVolume) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invVolumeDo) CreateInBatches(values []*models.InvVolume, batchSize int) error { + return i.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 (i invVolumeDo) Save(values ...*models.InvVolume) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invVolumeDo) First() (*models.InvVolume, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.InvVolume), nil + } +} + +func (i invVolumeDo) Take() (*models.InvVolume, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.InvVolume), nil + } +} + +func (i invVolumeDo) Last() (*models.InvVolume, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.InvVolume), nil + } +} + +func (i invVolumeDo) Find() ([]*models.InvVolume, error) { + result, err := i.DO.Find() + return result.([]*models.InvVolume), err +} + +func (i invVolumeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.InvVolume, err error) { + buf := make([]*models.InvVolume, 0, batchSize) + err = i.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 (i invVolumeDo) FindInBatches(result *[]*models.InvVolume, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invVolumeDo) Attrs(attrs ...field.AssignExpr) *invVolumeDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invVolumeDo) Assign(attrs ...field.AssignExpr) *invVolumeDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invVolumeDo) Joins(fields ...field.RelationField) *invVolumeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invVolumeDo) Preload(fields ...field.RelationField) *invVolumeDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invVolumeDo) FirstOrInit() (*models.InvVolume, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.InvVolume), nil + } +} + +func (i invVolumeDo) FirstOrCreate() (*models.InvVolume, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.InvVolume), nil + } +} + +func (i invVolumeDo) FindByPage(offset int, limit int) (result []*models.InvVolume, count int64, err error) { + result, err = i.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 = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invVolumeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invVolumeDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invVolumeDo) Delete(models ...*models.InvVolume) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invVolumeDo) withDO(do gen.Dao) *invVolumeDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/models/mapcelestialgraphics.gen.go b/models/mapcelestialgraphics.gen.go new file mode 100644 index 0000000..e2fdba0 --- /dev/null +++ b/models/mapcelestialgraphics.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapCelestialGraphic(db *gorm.DB, opts ...gen.DOOption) mapCelestialGraphic { + _mapCelestialGraphic := mapCelestialGraphic{} + + _mapCelestialGraphic.mapCelestialGraphicDo.UseDB(db, opts...) + _mapCelestialGraphic.mapCelestialGraphicDo.UseModel(&models.MapCelestialGraphic{}) + + tableName := _mapCelestialGraphic.mapCelestialGraphicDo.TableName() + _mapCelestialGraphic.ALL = field.NewAsterisk(tableName) + _mapCelestialGraphic.CelestialID = field.NewInt32(tableName, "celestialID") + _mapCelestialGraphic.HeightMap1 = field.NewInt32(tableName, "heightMap1") + _mapCelestialGraphic.HeightMap2 = field.NewInt32(tableName, "heightMap2") + _mapCelestialGraphic.ShaderPreset = field.NewInt32(tableName, "shaderPreset") + _mapCelestialGraphic.Population = field.NewBool(tableName, "population") + + _mapCelestialGraphic.fillFieldMap() + + return _mapCelestialGraphic +} + +type mapCelestialGraphic struct { + mapCelestialGraphicDo mapCelestialGraphicDo + + ALL field.Asterisk + CelestialID field.Int32 + HeightMap1 field.Int32 + HeightMap2 field.Int32 + ShaderPreset field.Int32 + Population field.Bool + + fieldMap map[string]field.Expr +} + +func (m mapCelestialGraphic) Table(newTableName string) *mapCelestialGraphic { + m.mapCelestialGraphicDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapCelestialGraphic) As(alias string) *mapCelestialGraphic { + m.mapCelestialGraphicDo.DO = *(m.mapCelestialGraphicDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapCelestialGraphic) updateTableName(table string) *mapCelestialGraphic { + m.ALL = field.NewAsterisk(table) + m.CelestialID = field.NewInt32(table, "celestialID") + m.HeightMap1 = field.NewInt32(table, "heightMap1") + m.HeightMap2 = field.NewInt32(table, "heightMap2") + m.ShaderPreset = field.NewInt32(table, "shaderPreset") + m.Population = field.NewBool(table, "population") + + m.fillFieldMap() + + return m +} + +func (m *mapCelestialGraphic) WithContext(ctx context.Context) *mapCelestialGraphicDo { + return m.mapCelestialGraphicDo.WithContext(ctx) +} + +func (m mapCelestialGraphic) TableName() string { return m.mapCelestialGraphicDo.TableName() } + +func (m mapCelestialGraphic) Alias() string { return m.mapCelestialGraphicDo.Alias() } + +func (m mapCelestialGraphic) Columns(cols ...field.Expr) gen.Columns { + return m.mapCelestialGraphicDo.Columns(cols...) +} + +func (m *mapCelestialGraphic) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapCelestialGraphic) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 5) + m.fieldMap["celestialID"] = m.CelestialID + m.fieldMap["heightMap1"] = m.HeightMap1 + m.fieldMap["heightMap2"] = m.HeightMap2 + m.fieldMap["shaderPreset"] = m.ShaderPreset + m.fieldMap["population"] = m.Population +} + +func (m mapCelestialGraphic) clone(db *gorm.DB) mapCelestialGraphic { + m.mapCelestialGraphicDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapCelestialGraphic) replaceDB(db *gorm.DB) mapCelestialGraphic { + m.mapCelestialGraphicDo.ReplaceDB(db) + return m +} + +type mapCelestialGraphicDo struct{ gen.DO } + +func (m mapCelestialGraphicDo) Debug() *mapCelestialGraphicDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapCelestialGraphicDo) WithContext(ctx context.Context) *mapCelestialGraphicDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapCelestialGraphicDo) ReadDB() *mapCelestialGraphicDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapCelestialGraphicDo) WriteDB() *mapCelestialGraphicDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapCelestialGraphicDo) Session(config *gorm.Session) *mapCelestialGraphicDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapCelestialGraphicDo) Clauses(conds ...clause.Expression) *mapCelestialGraphicDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapCelestialGraphicDo) Returning(value interface{}, columns ...string) *mapCelestialGraphicDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapCelestialGraphicDo) Not(conds ...gen.Condition) *mapCelestialGraphicDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapCelestialGraphicDo) Or(conds ...gen.Condition) *mapCelestialGraphicDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapCelestialGraphicDo) Select(conds ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapCelestialGraphicDo) Where(conds ...gen.Condition) *mapCelestialGraphicDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapCelestialGraphicDo) Order(conds ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapCelestialGraphicDo) Distinct(cols ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapCelestialGraphicDo) Omit(cols ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapCelestialGraphicDo) Join(table schema.Tabler, on ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapCelestialGraphicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapCelestialGraphicDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapCelestialGraphicDo) Group(cols ...field.Expr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapCelestialGraphicDo) Having(conds ...gen.Condition) *mapCelestialGraphicDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapCelestialGraphicDo) Limit(limit int) *mapCelestialGraphicDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapCelestialGraphicDo) Offset(offset int) *mapCelestialGraphicDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapCelestialGraphicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapCelestialGraphicDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapCelestialGraphicDo) Unscoped() *mapCelestialGraphicDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapCelestialGraphicDo) Create(values ...*models.MapCelestialGraphic) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapCelestialGraphicDo) CreateInBatches(values []*models.MapCelestialGraphic, batchSize int) error { + return m.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 (m mapCelestialGraphicDo) Save(values ...*models.MapCelestialGraphic) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapCelestialGraphicDo) First() (*models.MapCelestialGraphic, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialGraphic), nil + } +} + +func (m mapCelestialGraphicDo) Take() (*models.MapCelestialGraphic, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialGraphic), nil + } +} + +func (m mapCelestialGraphicDo) Last() (*models.MapCelestialGraphic, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialGraphic), nil + } +} + +func (m mapCelestialGraphicDo) Find() ([]*models.MapCelestialGraphic, error) { + result, err := m.DO.Find() + return result.([]*models.MapCelestialGraphic), err +} + +func (m mapCelestialGraphicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapCelestialGraphic, err error) { + buf := make([]*models.MapCelestialGraphic, 0, batchSize) + err = m.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 (m mapCelestialGraphicDo) FindInBatches(result *[]*models.MapCelestialGraphic, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapCelestialGraphicDo) Attrs(attrs ...field.AssignExpr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapCelestialGraphicDo) Assign(attrs ...field.AssignExpr) *mapCelestialGraphicDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapCelestialGraphicDo) Joins(fields ...field.RelationField) *mapCelestialGraphicDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapCelestialGraphicDo) Preload(fields ...field.RelationField) *mapCelestialGraphicDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapCelestialGraphicDo) FirstOrInit() (*models.MapCelestialGraphic, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialGraphic), nil + } +} + +func (m mapCelestialGraphicDo) FirstOrCreate() (*models.MapCelestialGraphic, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialGraphic), nil + } +} + +func (m mapCelestialGraphicDo) FindByPage(offset int, limit int) (result []*models.MapCelestialGraphic, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapCelestialGraphicDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapCelestialGraphicDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapCelestialGraphicDo) Delete(models ...*models.MapCelestialGraphic) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapCelestialGraphicDo) withDO(do gen.Dao) *mapCelestialGraphicDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapcelestialstatistics.gen.go b/models/mapcelestialstatistics.gen.go new file mode 100644 index 0000000..84ec7dd --- /dev/null +++ b/models/mapcelestialstatistics.gen.go @@ -0,0 +1,407 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapCelestialStatistic(db *gorm.DB, opts ...gen.DOOption) mapCelestialStatistic { + _mapCelestialStatistic := mapCelestialStatistic{} + + _mapCelestialStatistic.mapCelestialStatisticDo.UseDB(db, opts...) + _mapCelestialStatistic.mapCelestialStatisticDo.UseModel(&models.MapCelestialStatistic{}) + + tableName := _mapCelestialStatistic.mapCelestialStatisticDo.TableName() + _mapCelestialStatistic.ALL = field.NewAsterisk(tableName) + _mapCelestialStatistic.CelestialID = field.NewInt32(tableName, "celestialID") + _mapCelestialStatistic.Temperature = field.NewFloat64(tableName, "temperature") + _mapCelestialStatistic.SpectralClass = field.NewString(tableName, "spectralClass") + _mapCelestialStatistic.Luminosity = field.NewFloat64(tableName, "luminosity") + _mapCelestialStatistic.Age = field.NewFloat64(tableName, "age") + _mapCelestialStatistic.Life = field.NewFloat64(tableName, "life") + _mapCelestialStatistic.OrbitRadius = field.NewFloat64(tableName, "orbitRadius") + _mapCelestialStatistic.Eccentricity = field.NewFloat64(tableName, "eccentricity") + _mapCelestialStatistic.MassDust = field.NewFloat64(tableName, "massDust") + _mapCelestialStatistic.MassGas = field.NewFloat64(tableName, "massGas") + _mapCelestialStatistic.Fragmented = field.NewBool(tableName, "fragmented") + _mapCelestialStatistic.Density = field.NewFloat64(tableName, "density") + _mapCelestialStatistic.SurfaceGravity = field.NewFloat64(tableName, "surfaceGravity") + _mapCelestialStatistic.EscapeVelocity = field.NewFloat64(tableName, "escapeVelocity") + _mapCelestialStatistic.OrbitPeriod = field.NewFloat64(tableName, "orbitPeriod") + _mapCelestialStatistic.RotationRate = field.NewFloat64(tableName, "rotationRate") + _mapCelestialStatistic.Locked = field.NewBool(tableName, "locked") + _mapCelestialStatistic.Pressure = field.NewFloat64(tableName, "pressure") + _mapCelestialStatistic.Radius = field.NewFloat64(tableName, "radius") + _mapCelestialStatistic.Mass = field.NewInt32(tableName, "mass") + + _mapCelestialStatistic.fillFieldMap() + + return _mapCelestialStatistic +} + +type mapCelestialStatistic struct { + mapCelestialStatisticDo mapCelestialStatisticDo + + ALL field.Asterisk + CelestialID field.Int32 + Temperature field.Float64 + SpectralClass field.String + Luminosity field.Float64 + Age field.Float64 + Life field.Float64 + OrbitRadius field.Float64 + Eccentricity field.Float64 + MassDust field.Float64 + MassGas field.Float64 + Fragmented field.Bool + Density field.Float64 + SurfaceGravity field.Float64 + EscapeVelocity field.Float64 + OrbitPeriod field.Float64 + RotationRate field.Float64 + Locked field.Bool + Pressure field.Float64 + Radius field.Float64 + Mass field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapCelestialStatistic) Table(newTableName string) *mapCelestialStatistic { + m.mapCelestialStatisticDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapCelestialStatistic) As(alias string) *mapCelestialStatistic { + m.mapCelestialStatisticDo.DO = *(m.mapCelestialStatisticDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapCelestialStatistic) updateTableName(table string) *mapCelestialStatistic { + m.ALL = field.NewAsterisk(table) + m.CelestialID = field.NewInt32(table, "celestialID") + m.Temperature = field.NewFloat64(table, "temperature") + m.SpectralClass = field.NewString(table, "spectralClass") + m.Luminosity = field.NewFloat64(table, "luminosity") + m.Age = field.NewFloat64(table, "age") + m.Life = field.NewFloat64(table, "life") + m.OrbitRadius = field.NewFloat64(table, "orbitRadius") + m.Eccentricity = field.NewFloat64(table, "eccentricity") + m.MassDust = field.NewFloat64(table, "massDust") + m.MassGas = field.NewFloat64(table, "massGas") + m.Fragmented = field.NewBool(table, "fragmented") + m.Density = field.NewFloat64(table, "density") + m.SurfaceGravity = field.NewFloat64(table, "surfaceGravity") + m.EscapeVelocity = field.NewFloat64(table, "escapeVelocity") + m.OrbitPeriod = field.NewFloat64(table, "orbitPeriod") + m.RotationRate = field.NewFloat64(table, "rotationRate") + m.Locked = field.NewBool(table, "locked") + m.Pressure = field.NewFloat64(table, "pressure") + m.Radius = field.NewFloat64(table, "radius") + m.Mass = field.NewInt32(table, "mass") + + m.fillFieldMap() + + return m +} + +func (m *mapCelestialStatistic) WithContext(ctx context.Context) *mapCelestialStatisticDo { + return m.mapCelestialStatisticDo.WithContext(ctx) +} + +func (m mapCelestialStatistic) TableName() string { return m.mapCelestialStatisticDo.TableName() } + +func (m mapCelestialStatistic) Alias() string { return m.mapCelestialStatisticDo.Alias() } + +func (m mapCelestialStatistic) Columns(cols ...field.Expr) gen.Columns { + return m.mapCelestialStatisticDo.Columns(cols...) +} + +func (m *mapCelestialStatistic) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapCelestialStatistic) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 20) + m.fieldMap["celestialID"] = m.CelestialID + m.fieldMap["temperature"] = m.Temperature + m.fieldMap["spectralClass"] = m.SpectralClass + m.fieldMap["luminosity"] = m.Luminosity + m.fieldMap["age"] = m.Age + m.fieldMap["life"] = m.Life + m.fieldMap["orbitRadius"] = m.OrbitRadius + m.fieldMap["eccentricity"] = m.Eccentricity + m.fieldMap["massDust"] = m.MassDust + m.fieldMap["massGas"] = m.MassGas + m.fieldMap["fragmented"] = m.Fragmented + m.fieldMap["density"] = m.Density + m.fieldMap["surfaceGravity"] = m.SurfaceGravity + m.fieldMap["escapeVelocity"] = m.EscapeVelocity + m.fieldMap["orbitPeriod"] = m.OrbitPeriod + m.fieldMap["rotationRate"] = m.RotationRate + m.fieldMap["locked"] = m.Locked + m.fieldMap["pressure"] = m.Pressure + m.fieldMap["radius"] = m.Radius + m.fieldMap["mass"] = m.Mass +} + +func (m mapCelestialStatistic) clone(db *gorm.DB) mapCelestialStatistic { + m.mapCelestialStatisticDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapCelestialStatistic) replaceDB(db *gorm.DB) mapCelestialStatistic { + m.mapCelestialStatisticDo.ReplaceDB(db) + return m +} + +type mapCelestialStatisticDo struct{ gen.DO } + +func (m mapCelestialStatisticDo) Debug() *mapCelestialStatisticDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapCelestialStatisticDo) WithContext(ctx context.Context) *mapCelestialStatisticDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapCelestialStatisticDo) ReadDB() *mapCelestialStatisticDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapCelestialStatisticDo) WriteDB() *mapCelestialStatisticDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapCelestialStatisticDo) Session(config *gorm.Session) *mapCelestialStatisticDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapCelestialStatisticDo) Clauses(conds ...clause.Expression) *mapCelestialStatisticDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapCelestialStatisticDo) Returning(value interface{}, columns ...string) *mapCelestialStatisticDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapCelestialStatisticDo) Not(conds ...gen.Condition) *mapCelestialStatisticDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapCelestialStatisticDo) Or(conds ...gen.Condition) *mapCelestialStatisticDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapCelestialStatisticDo) Select(conds ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapCelestialStatisticDo) Where(conds ...gen.Condition) *mapCelestialStatisticDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapCelestialStatisticDo) Order(conds ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapCelestialStatisticDo) Distinct(cols ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapCelestialStatisticDo) Omit(cols ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapCelestialStatisticDo) Join(table schema.Tabler, on ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapCelestialStatisticDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapCelestialStatisticDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapCelestialStatisticDo) Group(cols ...field.Expr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapCelestialStatisticDo) Having(conds ...gen.Condition) *mapCelestialStatisticDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapCelestialStatisticDo) Limit(limit int) *mapCelestialStatisticDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapCelestialStatisticDo) Offset(offset int) *mapCelestialStatisticDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapCelestialStatisticDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapCelestialStatisticDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapCelestialStatisticDo) Unscoped() *mapCelestialStatisticDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapCelestialStatisticDo) Create(values ...*models.MapCelestialStatistic) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapCelestialStatisticDo) CreateInBatches(values []*models.MapCelestialStatistic, batchSize int) error { + return m.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 (m mapCelestialStatisticDo) Save(values ...*models.MapCelestialStatistic) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapCelestialStatisticDo) First() (*models.MapCelestialStatistic, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialStatistic), nil + } +} + +func (m mapCelestialStatisticDo) Take() (*models.MapCelestialStatistic, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialStatistic), nil + } +} + +func (m mapCelestialStatisticDo) Last() (*models.MapCelestialStatistic, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialStatistic), nil + } +} + +func (m mapCelestialStatisticDo) Find() ([]*models.MapCelestialStatistic, error) { + result, err := m.DO.Find() + return result.([]*models.MapCelestialStatistic), err +} + +func (m mapCelestialStatisticDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapCelestialStatistic, err error) { + buf := make([]*models.MapCelestialStatistic, 0, batchSize) + err = m.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 (m mapCelestialStatisticDo) FindInBatches(result *[]*models.MapCelestialStatistic, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapCelestialStatisticDo) Attrs(attrs ...field.AssignExpr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapCelestialStatisticDo) Assign(attrs ...field.AssignExpr) *mapCelestialStatisticDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapCelestialStatisticDo) Joins(fields ...field.RelationField) *mapCelestialStatisticDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapCelestialStatisticDo) Preload(fields ...field.RelationField) *mapCelestialStatisticDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapCelestialStatisticDo) FirstOrInit() (*models.MapCelestialStatistic, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialStatistic), nil + } +} + +func (m mapCelestialStatisticDo) FirstOrCreate() (*models.MapCelestialStatistic, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapCelestialStatistic), nil + } +} + +func (m mapCelestialStatisticDo) FindByPage(offset int, limit int) (result []*models.MapCelestialStatistic, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapCelestialStatisticDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapCelestialStatisticDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapCelestialStatisticDo) Delete(models ...*models.MapCelestialStatistic) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapCelestialStatisticDo) withDO(do gen.Dao) *mapCelestialStatisticDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapconstellationjumps.gen.go b/models/mapconstellationjumps.gen.go new file mode 100644 index 0000000..8e6e031 --- /dev/null +++ b/models/mapconstellationjumps.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapConstellationJump(db *gorm.DB, opts ...gen.DOOption) mapConstellationJump { + _mapConstellationJump := mapConstellationJump{} + + _mapConstellationJump.mapConstellationJumpDo.UseDB(db, opts...) + _mapConstellationJump.mapConstellationJumpDo.UseModel(&models.MapConstellationJump{}) + + tableName := _mapConstellationJump.mapConstellationJumpDo.TableName() + _mapConstellationJump.ALL = field.NewAsterisk(tableName) + _mapConstellationJump.FromRegionID = field.NewInt32(tableName, "fromRegionID") + _mapConstellationJump.FromConstellationID = field.NewInt32(tableName, "fromConstellationID") + _mapConstellationJump.ToConstellationID = field.NewInt32(tableName, "toConstellationID") + _mapConstellationJump.ToRegionID = field.NewInt32(tableName, "toRegionID") + + _mapConstellationJump.fillFieldMap() + + return _mapConstellationJump +} + +type mapConstellationJump struct { + mapConstellationJumpDo mapConstellationJumpDo + + ALL field.Asterisk + FromRegionID field.Int32 + FromConstellationID field.Int32 + ToConstellationID field.Int32 + ToRegionID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapConstellationJump) Table(newTableName string) *mapConstellationJump { + m.mapConstellationJumpDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapConstellationJump) As(alias string) *mapConstellationJump { + m.mapConstellationJumpDo.DO = *(m.mapConstellationJumpDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapConstellationJump) updateTableName(table string) *mapConstellationJump { + m.ALL = field.NewAsterisk(table) + m.FromRegionID = field.NewInt32(table, "fromRegionID") + m.FromConstellationID = field.NewInt32(table, "fromConstellationID") + m.ToConstellationID = field.NewInt32(table, "toConstellationID") + m.ToRegionID = field.NewInt32(table, "toRegionID") + + m.fillFieldMap() + + return m +} + +func (m *mapConstellationJump) WithContext(ctx context.Context) *mapConstellationJumpDo { + return m.mapConstellationJumpDo.WithContext(ctx) +} + +func (m mapConstellationJump) TableName() string { return m.mapConstellationJumpDo.TableName() } + +func (m mapConstellationJump) Alias() string { return m.mapConstellationJumpDo.Alias() } + +func (m mapConstellationJump) Columns(cols ...field.Expr) gen.Columns { + return m.mapConstellationJumpDo.Columns(cols...) +} + +func (m *mapConstellationJump) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapConstellationJump) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 4) + m.fieldMap["fromRegionID"] = m.FromRegionID + m.fieldMap["fromConstellationID"] = m.FromConstellationID + m.fieldMap["toConstellationID"] = m.ToConstellationID + m.fieldMap["toRegionID"] = m.ToRegionID +} + +func (m mapConstellationJump) clone(db *gorm.DB) mapConstellationJump { + m.mapConstellationJumpDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapConstellationJump) replaceDB(db *gorm.DB) mapConstellationJump { + m.mapConstellationJumpDo.ReplaceDB(db) + return m +} + +type mapConstellationJumpDo struct{ gen.DO } + +func (m mapConstellationJumpDo) Debug() *mapConstellationJumpDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapConstellationJumpDo) WithContext(ctx context.Context) *mapConstellationJumpDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapConstellationJumpDo) ReadDB() *mapConstellationJumpDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapConstellationJumpDo) WriteDB() *mapConstellationJumpDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapConstellationJumpDo) Session(config *gorm.Session) *mapConstellationJumpDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapConstellationJumpDo) Clauses(conds ...clause.Expression) *mapConstellationJumpDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapConstellationJumpDo) Returning(value interface{}, columns ...string) *mapConstellationJumpDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapConstellationJumpDo) Not(conds ...gen.Condition) *mapConstellationJumpDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapConstellationJumpDo) Or(conds ...gen.Condition) *mapConstellationJumpDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapConstellationJumpDo) Select(conds ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapConstellationJumpDo) Where(conds ...gen.Condition) *mapConstellationJumpDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapConstellationJumpDo) Order(conds ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapConstellationJumpDo) Distinct(cols ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapConstellationJumpDo) Omit(cols ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapConstellationJumpDo) Join(table schema.Tabler, on ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapConstellationJumpDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapConstellationJumpDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapConstellationJumpDo) Group(cols ...field.Expr) *mapConstellationJumpDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapConstellationJumpDo) Having(conds ...gen.Condition) *mapConstellationJumpDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapConstellationJumpDo) Limit(limit int) *mapConstellationJumpDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapConstellationJumpDo) Offset(offset int) *mapConstellationJumpDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapConstellationJumpDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapConstellationJumpDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapConstellationJumpDo) Unscoped() *mapConstellationJumpDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapConstellationJumpDo) Create(values ...*models.MapConstellationJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapConstellationJumpDo) CreateInBatches(values []*models.MapConstellationJump, batchSize int) error { + return m.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 (m mapConstellationJumpDo) Save(values ...*models.MapConstellationJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapConstellationJumpDo) First() (*models.MapConstellationJump, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellationJump), nil + } +} + +func (m mapConstellationJumpDo) Take() (*models.MapConstellationJump, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellationJump), nil + } +} + +func (m mapConstellationJumpDo) Last() (*models.MapConstellationJump, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellationJump), nil + } +} + +func (m mapConstellationJumpDo) Find() ([]*models.MapConstellationJump, error) { + result, err := m.DO.Find() + return result.([]*models.MapConstellationJump), err +} + +func (m mapConstellationJumpDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapConstellationJump, err error) { + buf := make([]*models.MapConstellationJump, 0, batchSize) + err = m.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 (m mapConstellationJumpDo) FindInBatches(result *[]*models.MapConstellationJump, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapConstellationJumpDo) Attrs(attrs ...field.AssignExpr) *mapConstellationJumpDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapConstellationJumpDo) Assign(attrs ...field.AssignExpr) *mapConstellationJumpDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapConstellationJumpDo) Joins(fields ...field.RelationField) *mapConstellationJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapConstellationJumpDo) Preload(fields ...field.RelationField) *mapConstellationJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapConstellationJumpDo) FirstOrInit() (*models.MapConstellationJump, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellationJump), nil + } +} + +func (m mapConstellationJumpDo) FirstOrCreate() (*models.MapConstellationJump, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellationJump), nil + } +} + +func (m mapConstellationJumpDo) FindByPage(offset int, limit int) (result []*models.MapConstellationJump, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapConstellationJumpDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapConstellationJumpDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapConstellationJumpDo) Delete(models ...*models.MapConstellationJump) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapConstellationJumpDo) withDO(do gen.Dao) *mapConstellationJumpDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapconstellations.gen.go b/models/mapconstellations.gen.go new file mode 100644 index 0000000..5042fef --- /dev/null +++ b/models/mapconstellations.gen.go @@ -0,0 +1,383 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapConstellation(db *gorm.DB, opts ...gen.DOOption) mapConstellation { + _mapConstellation := mapConstellation{} + + _mapConstellation.mapConstellationDo.UseDB(db, opts...) + _mapConstellation.mapConstellationDo.UseModel(&models.MapConstellation{}) + + tableName := _mapConstellation.mapConstellationDo.TableName() + _mapConstellation.ALL = field.NewAsterisk(tableName) + _mapConstellation.RegionID = field.NewInt32(tableName, "regionID") + _mapConstellation.ConstellationID = field.NewInt32(tableName, "constellationID") + _mapConstellation.ConstellationName = field.NewString(tableName, "constellationName") + _mapConstellation.X = field.NewFloat64(tableName, "x") + _mapConstellation.Y = field.NewFloat64(tableName, "y") + _mapConstellation.Z = field.NewFloat64(tableName, "z") + _mapConstellation.XMin = field.NewFloat64(tableName, "xMin") + _mapConstellation.XMax = field.NewFloat64(tableName, "xMax") + _mapConstellation.YMin = field.NewFloat64(tableName, "yMin") + _mapConstellation.YMax = field.NewFloat64(tableName, "yMax") + _mapConstellation.ZMin = field.NewFloat64(tableName, "zMin") + _mapConstellation.ZMax = field.NewFloat64(tableName, "zMax") + _mapConstellation.FactionID = field.NewInt32(tableName, "factionID") + _mapConstellation.Radius = field.NewFloat64(tableName, "radius") + + _mapConstellation.fillFieldMap() + + return _mapConstellation +} + +type mapConstellation struct { + mapConstellationDo mapConstellationDo + + ALL field.Asterisk + RegionID field.Int32 + ConstellationID field.Int32 + ConstellationName field.String + X field.Float64 + Y field.Float64 + Z field.Float64 + XMin field.Float64 + XMax field.Float64 + YMin field.Float64 + YMax field.Float64 + ZMin field.Float64 + ZMax field.Float64 + FactionID field.Int32 + Radius field.Float64 + + fieldMap map[string]field.Expr +} + +func (m mapConstellation) Table(newTableName string) *mapConstellation { + m.mapConstellationDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapConstellation) As(alias string) *mapConstellation { + m.mapConstellationDo.DO = *(m.mapConstellationDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapConstellation) updateTableName(table string) *mapConstellation { + m.ALL = field.NewAsterisk(table) + m.RegionID = field.NewInt32(table, "regionID") + m.ConstellationID = field.NewInt32(table, "constellationID") + m.ConstellationName = field.NewString(table, "constellationName") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.XMin = field.NewFloat64(table, "xMin") + m.XMax = field.NewFloat64(table, "xMax") + m.YMin = field.NewFloat64(table, "yMin") + m.YMax = field.NewFloat64(table, "yMax") + m.ZMin = field.NewFloat64(table, "zMin") + m.ZMax = field.NewFloat64(table, "zMax") + m.FactionID = field.NewInt32(table, "factionID") + m.Radius = field.NewFloat64(table, "radius") + + m.fillFieldMap() + + return m +} + +func (m *mapConstellation) WithContext(ctx context.Context) *mapConstellationDo { + return m.mapConstellationDo.WithContext(ctx) +} + +func (m mapConstellation) TableName() string { return m.mapConstellationDo.TableName() } + +func (m mapConstellation) Alias() string { return m.mapConstellationDo.Alias() } + +func (m mapConstellation) Columns(cols ...field.Expr) gen.Columns { + return m.mapConstellationDo.Columns(cols...) +} + +func (m *mapConstellation) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapConstellation) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 14) + m.fieldMap["regionID"] = m.RegionID + m.fieldMap["constellationID"] = m.ConstellationID + m.fieldMap["constellationName"] = m.ConstellationName + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["xMin"] = m.XMin + m.fieldMap["xMax"] = m.XMax + m.fieldMap["yMin"] = m.YMin + m.fieldMap["yMax"] = m.YMax + m.fieldMap["zMin"] = m.ZMin + m.fieldMap["zMax"] = m.ZMax + m.fieldMap["factionID"] = m.FactionID + m.fieldMap["radius"] = m.Radius +} + +func (m mapConstellation) clone(db *gorm.DB) mapConstellation { + m.mapConstellationDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapConstellation) replaceDB(db *gorm.DB) mapConstellation { + m.mapConstellationDo.ReplaceDB(db) + return m +} + +type mapConstellationDo struct{ gen.DO } + +func (m mapConstellationDo) Debug() *mapConstellationDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapConstellationDo) WithContext(ctx context.Context) *mapConstellationDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapConstellationDo) ReadDB() *mapConstellationDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapConstellationDo) WriteDB() *mapConstellationDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapConstellationDo) Session(config *gorm.Session) *mapConstellationDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapConstellationDo) Clauses(conds ...clause.Expression) *mapConstellationDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapConstellationDo) Returning(value interface{}, columns ...string) *mapConstellationDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapConstellationDo) Not(conds ...gen.Condition) *mapConstellationDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapConstellationDo) Or(conds ...gen.Condition) *mapConstellationDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapConstellationDo) Select(conds ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapConstellationDo) Where(conds ...gen.Condition) *mapConstellationDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapConstellationDo) Order(conds ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapConstellationDo) Distinct(cols ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapConstellationDo) Omit(cols ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapConstellationDo) Join(table schema.Tabler, on ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapConstellationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapConstellationDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapConstellationDo) Group(cols ...field.Expr) *mapConstellationDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapConstellationDo) Having(conds ...gen.Condition) *mapConstellationDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapConstellationDo) Limit(limit int) *mapConstellationDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapConstellationDo) Offset(offset int) *mapConstellationDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapConstellationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapConstellationDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapConstellationDo) Unscoped() *mapConstellationDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapConstellationDo) Create(values ...*models.MapConstellation) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapConstellationDo) CreateInBatches(values []*models.MapConstellation, batchSize int) error { + return m.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 (m mapConstellationDo) Save(values ...*models.MapConstellation) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapConstellationDo) First() (*models.MapConstellation, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellation), nil + } +} + +func (m mapConstellationDo) Take() (*models.MapConstellation, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellation), nil + } +} + +func (m mapConstellationDo) Last() (*models.MapConstellation, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellation), nil + } +} + +func (m mapConstellationDo) Find() ([]*models.MapConstellation, error) { + result, err := m.DO.Find() + return result.([]*models.MapConstellation), err +} + +func (m mapConstellationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapConstellation, err error) { + buf := make([]*models.MapConstellation, 0, batchSize) + err = m.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 (m mapConstellationDo) FindInBatches(result *[]*models.MapConstellation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapConstellationDo) Attrs(attrs ...field.AssignExpr) *mapConstellationDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapConstellationDo) Assign(attrs ...field.AssignExpr) *mapConstellationDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapConstellationDo) Joins(fields ...field.RelationField) *mapConstellationDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapConstellationDo) Preload(fields ...field.RelationField) *mapConstellationDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapConstellationDo) FirstOrInit() (*models.MapConstellation, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellation), nil + } +} + +func (m mapConstellationDo) FirstOrCreate() (*models.MapConstellation, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapConstellation), nil + } +} + +func (m mapConstellationDo) FindByPage(offset int, limit int) (result []*models.MapConstellation, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapConstellationDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapConstellationDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapConstellationDo) Delete(models ...*models.MapConstellation) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapConstellationDo) withDO(do gen.Dao) *mapConstellationDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapdenormalize.gen.go b/models/mapdenormalize.gen.go new file mode 100644 index 0000000..5655fd6 --- /dev/null +++ b/models/mapdenormalize.gen.go @@ -0,0 +1,387 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapDenormalize(db *gorm.DB, opts ...gen.DOOption) mapDenormalize { + _mapDenormalize := mapDenormalize{} + + _mapDenormalize.mapDenormalizeDo.UseDB(db, opts...) + _mapDenormalize.mapDenormalizeDo.UseModel(&models.MapDenormalize{}) + + tableName := _mapDenormalize.mapDenormalizeDo.TableName() + _mapDenormalize.ALL = field.NewAsterisk(tableName) + _mapDenormalize.ItemID = field.NewInt32(tableName, "itemID") + _mapDenormalize.TypeID = field.NewInt32(tableName, "typeID") + _mapDenormalize.GroupID = field.NewInt32(tableName, "groupID") + _mapDenormalize.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _mapDenormalize.ConstellationID = field.NewInt32(tableName, "constellationID") + _mapDenormalize.RegionID = field.NewInt32(tableName, "regionID") + _mapDenormalize.OrbitID = field.NewInt32(tableName, "orbitID") + _mapDenormalize.X = field.NewFloat64(tableName, "x") + _mapDenormalize.Y = field.NewFloat64(tableName, "y") + _mapDenormalize.Z = field.NewFloat64(tableName, "z") + _mapDenormalize.Radius = field.NewFloat64(tableName, "radius") + _mapDenormalize.ItemName = field.NewString(tableName, "itemName") + _mapDenormalize.Security = field.NewFloat64(tableName, "security") + _mapDenormalize.CelestialIndex = field.NewInt32(tableName, "celestialIndex") + _mapDenormalize.OrbitIndex = field.NewInt32(tableName, "orbitIndex") + + _mapDenormalize.fillFieldMap() + + return _mapDenormalize +} + +type mapDenormalize struct { + mapDenormalizeDo mapDenormalizeDo + + ALL field.Asterisk + ItemID field.Int32 + TypeID field.Int32 + GroupID field.Int32 + SolarSystemID field.Int32 + ConstellationID field.Int32 + RegionID field.Int32 + OrbitID field.Int32 + X field.Float64 + Y field.Float64 + Z field.Float64 + Radius field.Float64 + ItemName field.String + Security field.Float64 + CelestialIndex field.Int32 + OrbitIndex field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapDenormalize) Table(newTableName string) *mapDenormalize { + m.mapDenormalizeDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapDenormalize) As(alias string) *mapDenormalize { + m.mapDenormalizeDo.DO = *(m.mapDenormalizeDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapDenormalize) updateTableName(table string) *mapDenormalize { + m.ALL = field.NewAsterisk(table) + m.ItemID = field.NewInt32(table, "itemID") + m.TypeID = field.NewInt32(table, "typeID") + m.GroupID = field.NewInt32(table, "groupID") + m.SolarSystemID = field.NewInt32(table, "solarSystemID") + m.ConstellationID = field.NewInt32(table, "constellationID") + m.RegionID = field.NewInt32(table, "regionID") + m.OrbitID = field.NewInt32(table, "orbitID") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.Radius = field.NewFloat64(table, "radius") + m.ItemName = field.NewString(table, "itemName") + m.Security = field.NewFloat64(table, "security") + m.CelestialIndex = field.NewInt32(table, "celestialIndex") + m.OrbitIndex = field.NewInt32(table, "orbitIndex") + + m.fillFieldMap() + + return m +} + +func (m *mapDenormalize) WithContext(ctx context.Context) *mapDenormalizeDo { + return m.mapDenormalizeDo.WithContext(ctx) +} + +func (m mapDenormalize) TableName() string { return m.mapDenormalizeDo.TableName() } + +func (m mapDenormalize) Alias() string { return m.mapDenormalizeDo.Alias() } + +func (m mapDenormalize) Columns(cols ...field.Expr) gen.Columns { + return m.mapDenormalizeDo.Columns(cols...) +} + +func (m *mapDenormalize) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapDenormalize) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 15) + m.fieldMap["itemID"] = m.ItemID + m.fieldMap["typeID"] = m.TypeID + m.fieldMap["groupID"] = m.GroupID + m.fieldMap["solarSystemID"] = m.SolarSystemID + m.fieldMap["constellationID"] = m.ConstellationID + m.fieldMap["regionID"] = m.RegionID + m.fieldMap["orbitID"] = m.OrbitID + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["radius"] = m.Radius + m.fieldMap["itemName"] = m.ItemName + m.fieldMap["security"] = m.Security + m.fieldMap["celestialIndex"] = m.CelestialIndex + m.fieldMap["orbitIndex"] = m.OrbitIndex +} + +func (m mapDenormalize) clone(db *gorm.DB) mapDenormalize { + m.mapDenormalizeDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapDenormalize) replaceDB(db *gorm.DB) mapDenormalize { + m.mapDenormalizeDo.ReplaceDB(db) + return m +} + +type mapDenormalizeDo struct{ gen.DO } + +func (m mapDenormalizeDo) Debug() *mapDenormalizeDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapDenormalizeDo) WithContext(ctx context.Context) *mapDenormalizeDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapDenormalizeDo) ReadDB() *mapDenormalizeDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapDenormalizeDo) WriteDB() *mapDenormalizeDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapDenormalizeDo) Session(config *gorm.Session) *mapDenormalizeDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapDenormalizeDo) Clauses(conds ...clause.Expression) *mapDenormalizeDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapDenormalizeDo) Returning(value interface{}, columns ...string) *mapDenormalizeDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapDenormalizeDo) Not(conds ...gen.Condition) *mapDenormalizeDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapDenormalizeDo) Or(conds ...gen.Condition) *mapDenormalizeDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapDenormalizeDo) Select(conds ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapDenormalizeDo) Where(conds ...gen.Condition) *mapDenormalizeDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapDenormalizeDo) Order(conds ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapDenormalizeDo) Distinct(cols ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapDenormalizeDo) Omit(cols ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapDenormalizeDo) Join(table schema.Tabler, on ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapDenormalizeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapDenormalizeDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapDenormalizeDo) Group(cols ...field.Expr) *mapDenormalizeDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapDenormalizeDo) Having(conds ...gen.Condition) *mapDenormalizeDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapDenormalizeDo) Limit(limit int) *mapDenormalizeDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapDenormalizeDo) Offset(offset int) *mapDenormalizeDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapDenormalizeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapDenormalizeDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapDenormalizeDo) Unscoped() *mapDenormalizeDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapDenormalizeDo) Create(values ...*models.MapDenormalize) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapDenormalizeDo) CreateInBatches(values []*models.MapDenormalize, batchSize int) error { + return m.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 (m mapDenormalizeDo) Save(values ...*models.MapDenormalize) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapDenormalizeDo) First() (*models.MapDenormalize, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapDenormalize), nil + } +} + +func (m mapDenormalizeDo) Take() (*models.MapDenormalize, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapDenormalize), nil + } +} + +func (m mapDenormalizeDo) Last() (*models.MapDenormalize, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapDenormalize), nil + } +} + +func (m mapDenormalizeDo) Find() ([]*models.MapDenormalize, error) { + result, err := m.DO.Find() + return result.([]*models.MapDenormalize), err +} + +func (m mapDenormalizeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapDenormalize, err error) { + buf := make([]*models.MapDenormalize, 0, batchSize) + err = m.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 (m mapDenormalizeDo) FindInBatches(result *[]*models.MapDenormalize, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapDenormalizeDo) Attrs(attrs ...field.AssignExpr) *mapDenormalizeDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapDenormalizeDo) Assign(attrs ...field.AssignExpr) *mapDenormalizeDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapDenormalizeDo) Joins(fields ...field.RelationField) *mapDenormalizeDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapDenormalizeDo) Preload(fields ...field.RelationField) *mapDenormalizeDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapDenormalizeDo) FirstOrInit() (*models.MapDenormalize, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapDenormalize), nil + } +} + +func (m mapDenormalizeDo) FirstOrCreate() (*models.MapDenormalize, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapDenormalize), nil + } +} + +func (m mapDenormalizeDo) FindByPage(offset int, limit int) (result []*models.MapDenormalize, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapDenormalizeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapDenormalizeDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapDenormalizeDo) Delete(models ...*models.MapDenormalize) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapDenormalizeDo) withDO(do gen.Dao) *mapDenormalizeDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapjumps.gen.go b/models/mapjumps.gen.go new file mode 100644 index 0000000..71db8f3 --- /dev/null +++ b/models/mapjumps.gen.go @@ -0,0 +1,331 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapJump(db *gorm.DB, opts ...gen.DOOption) mapJump { + _mapJump := mapJump{} + + _mapJump.mapJumpDo.UseDB(db, opts...) + _mapJump.mapJumpDo.UseModel(&models.MapJump{}) + + tableName := _mapJump.mapJumpDo.TableName() + _mapJump.ALL = field.NewAsterisk(tableName) + _mapJump.StargateID = field.NewInt32(tableName, "stargateID") + _mapJump.DestinationID = field.NewInt32(tableName, "destinationID") + + _mapJump.fillFieldMap() + + return _mapJump +} + +type mapJump struct { + mapJumpDo mapJumpDo + + ALL field.Asterisk + StargateID field.Int32 + DestinationID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapJump) Table(newTableName string) *mapJump { + m.mapJumpDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapJump) As(alias string) *mapJump { + m.mapJumpDo.DO = *(m.mapJumpDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapJump) updateTableName(table string) *mapJump { + m.ALL = field.NewAsterisk(table) + m.StargateID = field.NewInt32(table, "stargateID") + m.DestinationID = field.NewInt32(table, "destinationID") + + m.fillFieldMap() + + return m +} + +func (m *mapJump) WithContext(ctx context.Context) *mapJumpDo { return m.mapJumpDo.WithContext(ctx) } + +func (m mapJump) TableName() string { return m.mapJumpDo.TableName() } + +func (m mapJump) Alias() string { return m.mapJumpDo.Alias() } + +func (m mapJump) Columns(cols ...field.Expr) gen.Columns { return m.mapJumpDo.Columns(cols...) } + +func (m *mapJump) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapJump) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 2) + m.fieldMap["stargateID"] = m.StargateID + m.fieldMap["destinationID"] = m.DestinationID +} + +func (m mapJump) clone(db *gorm.DB) mapJump { + m.mapJumpDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapJump) replaceDB(db *gorm.DB) mapJump { + m.mapJumpDo.ReplaceDB(db) + return m +} + +type mapJumpDo struct{ gen.DO } + +func (m mapJumpDo) Debug() *mapJumpDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapJumpDo) WithContext(ctx context.Context) *mapJumpDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapJumpDo) ReadDB() *mapJumpDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapJumpDo) WriteDB() *mapJumpDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapJumpDo) Session(config *gorm.Session) *mapJumpDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapJumpDo) Clauses(conds ...clause.Expression) *mapJumpDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapJumpDo) Returning(value interface{}, columns ...string) *mapJumpDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapJumpDo) Not(conds ...gen.Condition) *mapJumpDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapJumpDo) Or(conds ...gen.Condition) *mapJumpDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapJumpDo) Select(conds ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapJumpDo) Where(conds ...gen.Condition) *mapJumpDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapJumpDo) Order(conds ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapJumpDo) Distinct(cols ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapJumpDo) Omit(cols ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapJumpDo) Join(table schema.Tabler, on ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapJumpDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapJumpDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapJumpDo) Group(cols ...field.Expr) *mapJumpDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapJumpDo) Having(conds ...gen.Condition) *mapJumpDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapJumpDo) Limit(limit int) *mapJumpDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapJumpDo) Offset(offset int) *mapJumpDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapJumpDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapJumpDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapJumpDo) Unscoped() *mapJumpDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapJumpDo) Create(values ...*models.MapJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapJumpDo) CreateInBatches(values []*models.MapJump, batchSize int) error { + return m.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 (m mapJumpDo) Save(values ...*models.MapJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapJumpDo) First() (*models.MapJump, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapJump), nil + } +} + +func (m mapJumpDo) Take() (*models.MapJump, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapJump), nil + } +} + +func (m mapJumpDo) Last() (*models.MapJump, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapJump), nil + } +} + +func (m mapJumpDo) Find() ([]*models.MapJump, error) { + result, err := m.DO.Find() + return result.([]*models.MapJump), err +} + +func (m mapJumpDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapJump, err error) { + buf := make([]*models.MapJump, 0, batchSize) + err = m.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 (m mapJumpDo) FindInBatches(result *[]*models.MapJump, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapJumpDo) Attrs(attrs ...field.AssignExpr) *mapJumpDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapJumpDo) Assign(attrs ...field.AssignExpr) *mapJumpDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapJumpDo) Joins(fields ...field.RelationField) *mapJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapJumpDo) Preload(fields ...field.RelationField) *mapJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapJumpDo) FirstOrInit() (*models.MapJump, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapJump), nil + } +} + +func (m mapJumpDo) FirstOrCreate() (*models.MapJump, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapJump), nil + } +} + +func (m mapJumpDo) FindByPage(offset int, limit int) (result []*models.MapJump, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapJumpDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapJumpDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapJumpDo) Delete(models ...*models.MapJump) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapJumpDo) withDO(do gen.Dao) *mapJumpDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/maplandmarks.gen.go b/models/maplandmarks.gen.go new file mode 100644 index 0000000..9354ebd --- /dev/null +++ b/models/maplandmarks.gen.go @@ -0,0 +1,357 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapLandmark(db *gorm.DB, opts ...gen.DOOption) mapLandmark { + _mapLandmark := mapLandmark{} + + _mapLandmark.mapLandmarkDo.UseDB(db, opts...) + _mapLandmark.mapLandmarkDo.UseModel(&models.MapLandmark{}) + + tableName := _mapLandmark.mapLandmarkDo.TableName() + _mapLandmark.ALL = field.NewAsterisk(tableName) + _mapLandmark.LandmarkID = field.NewInt32(tableName, "landmarkID") + _mapLandmark.LandmarkName = field.NewString(tableName, "landmarkName") + _mapLandmark.Description = field.NewString(tableName, "description") + _mapLandmark.LocationID = field.NewInt32(tableName, "locationID") + _mapLandmark.X = field.NewFloat64(tableName, "x") + _mapLandmark.Y = field.NewFloat64(tableName, "y") + _mapLandmark.Z = field.NewFloat64(tableName, "z") + _mapLandmark.IconID = field.NewInt32(tableName, "iconID") + + _mapLandmark.fillFieldMap() + + return _mapLandmark +} + +type mapLandmark struct { + mapLandmarkDo mapLandmarkDo + + ALL field.Asterisk + LandmarkID field.Int32 + LandmarkName field.String + Description field.String + LocationID field.Int32 + X field.Float64 + Y field.Float64 + Z field.Float64 + IconID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapLandmark) Table(newTableName string) *mapLandmark { + m.mapLandmarkDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapLandmark) As(alias string) *mapLandmark { + m.mapLandmarkDo.DO = *(m.mapLandmarkDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapLandmark) updateTableName(table string) *mapLandmark { + m.ALL = field.NewAsterisk(table) + m.LandmarkID = field.NewInt32(table, "landmarkID") + m.LandmarkName = field.NewString(table, "landmarkName") + m.Description = field.NewString(table, "description") + m.LocationID = field.NewInt32(table, "locationID") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.IconID = field.NewInt32(table, "iconID") + + m.fillFieldMap() + + return m +} + +func (m *mapLandmark) WithContext(ctx context.Context) *mapLandmarkDo { + return m.mapLandmarkDo.WithContext(ctx) +} + +func (m mapLandmark) TableName() string { return m.mapLandmarkDo.TableName() } + +func (m mapLandmark) Alias() string { return m.mapLandmarkDo.Alias() } + +func (m mapLandmark) Columns(cols ...field.Expr) gen.Columns { return m.mapLandmarkDo.Columns(cols...) } + +func (m *mapLandmark) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapLandmark) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 8) + m.fieldMap["landmarkID"] = m.LandmarkID + m.fieldMap["landmarkName"] = m.LandmarkName + m.fieldMap["description"] = m.Description + m.fieldMap["locationID"] = m.LocationID + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["iconID"] = m.IconID +} + +func (m mapLandmark) clone(db *gorm.DB) mapLandmark { + m.mapLandmarkDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapLandmark) replaceDB(db *gorm.DB) mapLandmark { + m.mapLandmarkDo.ReplaceDB(db) + return m +} + +type mapLandmarkDo struct{ gen.DO } + +func (m mapLandmarkDo) Debug() *mapLandmarkDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapLandmarkDo) WithContext(ctx context.Context) *mapLandmarkDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapLandmarkDo) ReadDB() *mapLandmarkDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapLandmarkDo) WriteDB() *mapLandmarkDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapLandmarkDo) Session(config *gorm.Session) *mapLandmarkDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapLandmarkDo) Clauses(conds ...clause.Expression) *mapLandmarkDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapLandmarkDo) Returning(value interface{}, columns ...string) *mapLandmarkDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapLandmarkDo) Not(conds ...gen.Condition) *mapLandmarkDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapLandmarkDo) Or(conds ...gen.Condition) *mapLandmarkDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapLandmarkDo) Select(conds ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapLandmarkDo) Where(conds ...gen.Condition) *mapLandmarkDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapLandmarkDo) Order(conds ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapLandmarkDo) Distinct(cols ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapLandmarkDo) Omit(cols ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapLandmarkDo) Join(table schema.Tabler, on ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapLandmarkDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapLandmarkDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapLandmarkDo) Group(cols ...field.Expr) *mapLandmarkDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapLandmarkDo) Having(conds ...gen.Condition) *mapLandmarkDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapLandmarkDo) Limit(limit int) *mapLandmarkDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapLandmarkDo) Offset(offset int) *mapLandmarkDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapLandmarkDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapLandmarkDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapLandmarkDo) Unscoped() *mapLandmarkDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapLandmarkDo) Create(values ...*models.MapLandmark) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapLandmarkDo) CreateInBatches(values []*models.MapLandmark, batchSize int) error { + return m.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 (m mapLandmarkDo) Save(values ...*models.MapLandmark) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapLandmarkDo) First() (*models.MapLandmark, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapLandmark), nil + } +} + +func (m mapLandmarkDo) Take() (*models.MapLandmark, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapLandmark), nil + } +} + +func (m mapLandmarkDo) Last() (*models.MapLandmark, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapLandmark), nil + } +} + +func (m mapLandmarkDo) Find() ([]*models.MapLandmark, error) { + result, err := m.DO.Find() + return result.([]*models.MapLandmark), err +} + +func (m mapLandmarkDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapLandmark, err error) { + buf := make([]*models.MapLandmark, 0, batchSize) + err = m.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 (m mapLandmarkDo) FindInBatches(result *[]*models.MapLandmark, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapLandmarkDo) Attrs(attrs ...field.AssignExpr) *mapLandmarkDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapLandmarkDo) Assign(attrs ...field.AssignExpr) *mapLandmarkDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapLandmarkDo) Joins(fields ...field.RelationField) *mapLandmarkDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapLandmarkDo) Preload(fields ...field.RelationField) *mapLandmarkDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapLandmarkDo) FirstOrInit() (*models.MapLandmark, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapLandmark), nil + } +} + +func (m mapLandmarkDo) FirstOrCreate() (*models.MapLandmark, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapLandmark), nil + } +} + +func (m mapLandmarkDo) FindByPage(offset int, limit int) (result []*models.MapLandmark, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapLandmarkDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapLandmarkDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapLandmarkDo) Delete(models ...*models.MapLandmark) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapLandmarkDo) withDO(do gen.Dao) *mapLandmarkDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/maplocationscenes.gen.go b/models/maplocationscenes.gen.go new file mode 100644 index 0000000..cb74b03 --- /dev/null +++ b/models/maplocationscenes.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapLocationScene(db *gorm.DB, opts ...gen.DOOption) mapLocationScene { + _mapLocationScene := mapLocationScene{} + + _mapLocationScene.mapLocationSceneDo.UseDB(db, opts...) + _mapLocationScene.mapLocationSceneDo.UseModel(&models.MapLocationScene{}) + + tableName := _mapLocationScene.mapLocationSceneDo.TableName() + _mapLocationScene.ALL = field.NewAsterisk(tableName) + _mapLocationScene.LocationID = field.NewInt32(tableName, "locationID") + _mapLocationScene.GraphicID = field.NewInt32(tableName, "graphicID") + + _mapLocationScene.fillFieldMap() + + return _mapLocationScene +} + +type mapLocationScene struct { + mapLocationSceneDo mapLocationSceneDo + + ALL field.Asterisk + LocationID field.Int32 + GraphicID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapLocationScene) Table(newTableName string) *mapLocationScene { + m.mapLocationSceneDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapLocationScene) As(alias string) *mapLocationScene { + m.mapLocationSceneDo.DO = *(m.mapLocationSceneDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapLocationScene) updateTableName(table string) *mapLocationScene { + m.ALL = field.NewAsterisk(table) + m.LocationID = field.NewInt32(table, "locationID") + m.GraphicID = field.NewInt32(table, "graphicID") + + m.fillFieldMap() + + return m +} + +func (m *mapLocationScene) WithContext(ctx context.Context) *mapLocationSceneDo { + return m.mapLocationSceneDo.WithContext(ctx) +} + +func (m mapLocationScene) TableName() string { return m.mapLocationSceneDo.TableName() } + +func (m mapLocationScene) Alias() string { return m.mapLocationSceneDo.Alias() } + +func (m mapLocationScene) Columns(cols ...field.Expr) gen.Columns { + return m.mapLocationSceneDo.Columns(cols...) +} + +func (m *mapLocationScene) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapLocationScene) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 2) + m.fieldMap["locationID"] = m.LocationID + m.fieldMap["graphicID"] = m.GraphicID +} + +func (m mapLocationScene) clone(db *gorm.DB) mapLocationScene { + m.mapLocationSceneDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapLocationScene) replaceDB(db *gorm.DB) mapLocationScene { + m.mapLocationSceneDo.ReplaceDB(db) + return m +} + +type mapLocationSceneDo struct{ gen.DO } + +func (m mapLocationSceneDo) Debug() *mapLocationSceneDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapLocationSceneDo) WithContext(ctx context.Context) *mapLocationSceneDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapLocationSceneDo) ReadDB() *mapLocationSceneDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapLocationSceneDo) WriteDB() *mapLocationSceneDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapLocationSceneDo) Session(config *gorm.Session) *mapLocationSceneDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapLocationSceneDo) Clauses(conds ...clause.Expression) *mapLocationSceneDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapLocationSceneDo) Returning(value interface{}, columns ...string) *mapLocationSceneDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapLocationSceneDo) Not(conds ...gen.Condition) *mapLocationSceneDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapLocationSceneDo) Or(conds ...gen.Condition) *mapLocationSceneDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapLocationSceneDo) Select(conds ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapLocationSceneDo) Where(conds ...gen.Condition) *mapLocationSceneDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapLocationSceneDo) Order(conds ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapLocationSceneDo) Distinct(cols ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapLocationSceneDo) Omit(cols ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapLocationSceneDo) Join(table schema.Tabler, on ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapLocationSceneDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapLocationSceneDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapLocationSceneDo) Group(cols ...field.Expr) *mapLocationSceneDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapLocationSceneDo) Having(conds ...gen.Condition) *mapLocationSceneDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapLocationSceneDo) Limit(limit int) *mapLocationSceneDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapLocationSceneDo) Offset(offset int) *mapLocationSceneDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapLocationSceneDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapLocationSceneDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapLocationSceneDo) Unscoped() *mapLocationSceneDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapLocationSceneDo) Create(values ...*models.MapLocationScene) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapLocationSceneDo) CreateInBatches(values []*models.MapLocationScene, batchSize int) error { + return m.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 (m mapLocationSceneDo) Save(values ...*models.MapLocationScene) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapLocationSceneDo) First() (*models.MapLocationScene, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationScene), nil + } +} + +func (m mapLocationSceneDo) Take() (*models.MapLocationScene, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationScene), nil + } +} + +func (m mapLocationSceneDo) Last() (*models.MapLocationScene, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationScene), nil + } +} + +func (m mapLocationSceneDo) Find() ([]*models.MapLocationScene, error) { + result, err := m.DO.Find() + return result.([]*models.MapLocationScene), err +} + +func (m mapLocationSceneDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapLocationScene, err error) { + buf := make([]*models.MapLocationScene, 0, batchSize) + err = m.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 (m mapLocationSceneDo) FindInBatches(result *[]*models.MapLocationScene, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapLocationSceneDo) Attrs(attrs ...field.AssignExpr) *mapLocationSceneDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapLocationSceneDo) Assign(attrs ...field.AssignExpr) *mapLocationSceneDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapLocationSceneDo) Joins(fields ...field.RelationField) *mapLocationSceneDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapLocationSceneDo) Preload(fields ...field.RelationField) *mapLocationSceneDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapLocationSceneDo) FirstOrInit() (*models.MapLocationScene, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationScene), nil + } +} + +func (m mapLocationSceneDo) FirstOrCreate() (*models.MapLocationScene, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationScene), nil + } +} + +func (m mapLocationSceneDo) FindByPage(offset int, limit int) (result []*models.MapLocationScene, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapLocationSceneDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapLocationSceneDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapLocationSceneDo) Delete(models ...*models.MapLocationScene) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapLocationSceneDo) withDO(do gen.Dao) *mapLocationSceneDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/maplocationwormholeclasses.gen.go b/models/maplocationwormholeclasses.gen.go new file mode 100644 index 0000000..3afb20c --- /dev/null +++ b/models/maplocationwormholeclasses.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapLocationWormholeClass(db *gorm.DB, opts ...gen.DOOption) mapLocationWormholeClass { + _mapLocationWormholeClass := mapLocationWormholeClass{} + + _mapLocationWormholeClass.mapLocationWormholeClassDo.UseDB(db, opts...) + _mapLocationWormholeClass.mapLocationWormholeClassDo.UseModel(&models.MapLocationWormholeClass{}) + + tableName := _mapLocationWormholeClass.mapLocationWormholeClassDo.TableName() + _mapLocationWormholeClass.ALL = field.NewAsterisk(tableName) + _mapLocationWormholeClass.LocationID = field.NewInt32(tableName, "locationID") + _mapLocationWormholeClass.WormholeClassID = field.NewInt32(tableName, "wormholeClassID") + + _mapLocationWormholeClass.fillFieldMap() + + return _mapLocationWormholeClass +} + +type mapLocationWormholeClass struct { + mapLocationWormholeClassDo mapLocationWormholeClassDo + + ALL field.Asterisk + LocationID field.Int32 + WormholeClassID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapLocationWormholeClass) Table(newTableName string) *mapLocationWormholeClass { + m.mapLocationWormholeClassDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapLocationWormholeClass) As(alias string) *mapLocationWormholeClass { + m.mapLocationWormholeClassDo.DO = *(m.mapLocationWormholeClassDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapLocationWormholeClass) updateTableName(table string) *mapLocationWormholeClass { + m.ALL = field.NewAsterisk(table) + m.LocationID = field.NewInt32(table, "locationID") + m.WormholeClassID = field.NewInt32(table, "wormholeClassID") + + m.fillFieldMap() + + return m +} + +func (m *mapLocationWormholeClass) WithContext(ctx context.Context) *mapLocationWormholeClassDo { + return m.mapLocationWormholeClassDo.WithContext(ctx) +} + +func (m mapLocationWormholeClass) TableName() string { return m.mapLocationWormholeClassDo.TableName() } + +func (m mapLocationWormholeClass) Alias() string { return m.mapLocationWormholeClassDo.Alias() } + +func (m mapLocationWormholeClass) Columns(cols ...field.Expr) gen.Columns { + return m.mapLocationWormholeClassDo.Columns(cols...) +} + +func (m *mapLocationWormholeClass) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapLocationWormholeClass) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 2) + m.fieldMap["locationID"] = m.LocationID + m.fieldMap["wormholeClassID"] = m.WormholeClassID +} + +func (m mapLocationWormholeClass) clone(db *gorm.DB) mapLocationWormholeClass { + m.mapLocationWormholeClassDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapLocationWormholeClass) replaceDB(db *gorm.DB) mapLocationWormholeClass { + m.mapLocationWormholeClassDo.ReplaceDB(db) + return m +} + +type mapLocationWormholeClassDo struct{ gen.DO } + +func (m mapLocationWormholeClassDo) Debug() *mapLocationWormholeClassDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapLocationWormholeClassDo) WithContext(ctx context.Context) *mapLocationWormholeClassDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapLocationWormholeClassDo) ReadDB() *mapLocationWormholeClassDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapLocationWormholeClassDo) WriteDB() *mapLocationWormholeClassDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapLocationWormholeClassDo) Session(config *gorm.Session) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapLocationWormholeClassDo) Clauses(conds ...clause.Expression) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapLocationWormholeClassDo) Returning(value interface{}, columns ...string) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapLocationWormholeClassDo) Not(conds ...gen.Condition) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapLocationWormholeClassDo) Or(conds ...gen.Condition) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapLocationWormholeClassDo) Select(conds ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapLocationWormholeClassDo) Where(conds ...gen.Condition) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapLocationWormholeClassDo) Order(conds ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapLocationWormholeClassDo) Distinct(cols ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapLocationWormholeClassDo) Omit(cols ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapLocationWormholeClassDo) Join(table schema.Tabler, on ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapLocationWormholeClassDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapLocationWormholeClassDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapLocationWormholeClassDo) Group(cols ...field.Expr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapLocationWormholeClassDo) Having(conds ...gen.Condition) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapLocationWormholeClassDo) Limit(limit int) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapLocationWormholeClassDo) Offset(offset int) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapLocationWormholeClassDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapLocationWormholeClassDo) Unscoped() *mapLocationWormholeClassDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapLocationWormholeClassDo) Create(values ...*models.MapLocationWormholeClass) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapLocationWormholeClassDo) CreateInBatches(values []*models.MapLocationWormholeClass, batchSize int) error { + return m.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 (m mapLocationWormholeClassDo) Save(values ...*models.MapLocationWormholeClass) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapLocationWormholeClassDo) First() (*models.MapLocationWormholeClass, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationWormholeClass), nil + } +} + +func (m mapLocationWormholeClassDo) Take() (*models.MapLocationWormholeClass, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationWormholeClass), nil + } +} + +func (m mapLocationWormholeClassDo) Last() (*models.MapLocationWormholeClass, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationWormholeClass), nil + } +} + +func (m mapLocationWormholeClassDo) Find() ([]*models.MapLocationWormholeClass, error) { + result, err := m.DO.Find() + return result.([]*models.MapLocationWormholeClass), err +} + +func (m mapLocationWormholeClassDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapLocationWormholeClass, err error) { + buf := make([]*models.MapLocationWormholeClass, 0, batchSize) + err = m.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 (m mapLocationWormholeClassDo) FindInBatches(result *[]*models.MapLocationWormholeClass, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapLocationWormholeClassDo) Attrs(attrs ...field.AssignExpr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapLocationWormholeClassDo) Assign(attrs ...field.AssignExpr) *mapLocationWormholeClassDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapLocationWormholeClassDo) Joins(fields ...field.RelationField) *mapLocationWormholeClassDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapLocationWormholeClassDo) Preload(fields ...field.RelationField) *mapLocationWormholeClassDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapLocationWormholeClassDo) FirstOrInit() (*models.MapLocationWormholeClass, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationWormholeClass), nil + } +} + +func (m mapLocationWormholeClassDo) FirstOrCreate() (*models.MapLocationWormholeClass, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapLocationWormholeClass), nil + } +} + +func (m mapLocationWormholeClassDo) FindByPage(offset int, limit int) (result []*models.MapLocationWormholeClass, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapLocationWormholeClassDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapLocationWormholeClassDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapLocationWormholeClassDo) Delete(models ...*models.MapLocationWormholeClass) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapLocationWormholeClassDo) withDO(do gen.Dao) *mapLocationWormholeClassDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapregionjumps.gen.go b/models/mapregionjumps.gen.go new file mode 100644 index 0000000..da00e85 --- /dev/null +++ b/models/mapregionjumps.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapRegionJump(db *gorm.DB, opts ...gen.DOOption) mapRegionJump { + _mapRegionJump := mapRegionJump{} + + _mapRegionJump.mapRegionJumpDo.UseDB(db, opts...) + _mapRegionJump.mapRegionJumpDo.UseModel(&models.MapRegionJump{}) + + tableName := _mapRegionJump.mapRegionJumpDo.TableName() + _mapRegionJump.ALL = field.NewAsterisk(tableName) + _mapRegionJump.FromRegionID = field.NewInt32(tableName, "fromRegionID") + _mapRegionJump.ToRegionID = field.NewInt32(tableName, "toRegionID") + + _mapRegionJump.fillFieldMap() + + return _mapRegionJump +} + +type mapRegionJump struct { + mapRegionJumpDo mapRegionJumpDo + + ALL field.Asterisk + FromRegionID field.Int32 + ToRegionID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapRegionJump) Table(newTableName string) *mapRegionJump { + m.mapRegionJumpDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapRegionJump) As(alias string) *mapRegionJump { + m.mapRegionJumpDo.DO = *(m.mapRegionJumpDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapRegionJump) updateTableName(table string) *mapRegionJump { + m.ALL = field.NewAsterisk(table) + m.FromRegionID = field.NewInt32(table, "fromRegionID") + m.ToRegionID = field.NewInt32(table, "toRegionID") + + m.fillFieldMap() + + return m +} + +func (m *mapRegionJump) WithContext(ctx context.Context) *mapRegionJumpDo { + return m.mapRegionJumpDo.WithContext(ctx) +} + +func (m mapRegionJump) TableName() string { return m.mapRegionJumpDo.TableName() } + +func (m mapRegionJump) Alias() string { return m.mapRegionJumpDo.Alias() } + +func (m mapRegionJump) Columns(cols ...field.Expr) gen.Columns { + return m.mapRegionJumpDo.Columns(cols...) +} + +func (m *mapRegionJump) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapRegionJump) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 2) + m.fieldMap["fromRegionID"] = m.FromRegionID + m.fieldMap["toRegionID"] = m.ToRegionID +} + +func (m mapRegionJump) clone(db *gorm.DB) mapRegionJump { + m.mapRegionJumpDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapRegionJump) replaceDB(db *gorm.DB) mapRegionJump { + m.mapRegionJumpDo.ReplaceDB(db) + return m +} + +type mapRegionJumpDo struct{ gen.DO } + +func (m mapRegionJumpDo) Debug() *mapRegionJumpDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapRegionJumpDo) WithContext(ctx context.Context) *mapRegionJumpDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapRegionJumpDo) ReadDB() *mapRegionJumpDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapRegionJumpDo) WriteDB() *mapRegionJumpDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapRegionJumpDo) Session(config *gorm.Session) *mapRegionJumpDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapRegionJumpDo) Clauses(conds ...clause.Expression) *mapRegionJumpDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapRegionJumpDo) Returning(value interface{}, columns ...string) *mapRegionJumpDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapRegionJumpDo) Not(conds ...gen.Condition) *mapRegionJumpDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapRegionJumpDo) Or(conds ...gen.Condition) *mapRegionJumpDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapRegionJumpDo) Select(conds ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapRegionJumpDo) Where(conds ...gen.Condition) *mapRegionJumpDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapRegionJumpDo) Order(conds ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapRegionJumpDo) Distinct(cols ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapRegionJumpDo) Omit(cols ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapRegionJumpDo) Join(table schema.Tabler, on ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapRegionJumpDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapRegionJumpDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapRegionJumpDo) Group(cols ...field.Expr) *mapRegionJumpDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapRegionJumpDo) Having(conds ...gen.Condition) *mapRegionJumpDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapRegionJumpDo) Limit(limit int) *mapRegionJumpDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapRegionJumpDo) Offset(offset int) *mapRegionJumpDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapRegionJumpDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapRegionJumpDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapRegionJumpDo) Unscoped() *mapRegionJumpDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapRegionJumpDo) Create(values ...*models.MapRegionJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapRegionJumpDo) CreateInBatches(values []*models.MapRegionJump, batchSize int) error { + return m.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 (m mapRegionJumpDo) Save(values ...*models.MapRegionJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapRegionJumpDo) First() (*models.MapRegionJump, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapRegionJump), nil + } +} + +func (m mapRegionJumpDo) Take() (*models.MapRegionJump, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapRegionJump), nil + } +} + +func (m mapRegionJumpDo) Last() (*models.MapRegionJump, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapRegionJump), nil + } +} + +func (m mapRegionJumpDo) Find() ([]*models.MapRegionJump, error) { + result, err := m.DO.Find() + return result.([]*models.MapRegionJump), err +} + +func (m mapRegionJumpDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapRegionJump, err error) { + buf := make([]*models.MapRegionJump, 0, batchSize) + err = m.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 (m mapRegionJumpDo) FindInBatches(result *[]*models.MapRegionJump, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapRegionJumpDo) Attrs(attrs ...field.AssignExpr) *mapRegionJumpDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapRegionJumpDo) Assign(attrs ...field.AssignExpr) *mapRegionJumpDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapRegionJumpDo) Joins(fields ...field.RelationField) *mapRegionJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapRegionJumpDo) Preload(fields ...field.RelationField) *mapRegionJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapRegionJumpDo) FirstOrInit() (*models.MapRegionJump, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapRegionJump), nil + } +} + +func (m mapRegionJumpDo) FirstOrCreate() (*models.MapRegionJump, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapRegionJump), nil + } +} + +func (m mapRegionJumpDo) FindByPage(offset int, limit int) (result []*models.MapRegionJump, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapRegionJumpDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapRegionJumpDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapRegionJumpDo) Delete(models ...*models.MapRegionJump) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapRegionJumpDo) withDO(do gen.Dao) *mapRegionJumpDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapregions.gen.go b/models/mapregions.gen.go new file mode 100644 index 0000000..6e5117f --- /dev/null +++ b/models/mapregions.gen.go @@ -0,0 +1,381 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapRegion(db *gorm.DB, opts ...gen.DOOption) mapRegion { + _mapRegion := mapRegion{} + + _mapRegion.mapRegionDo.UseDB(db, opts...) + _mapRegion.mapRegionDo.UseModel(&models.MapRegion{}) + + tableName := _mapRegion.mapRegionDo.TableName() + _mapRegion.ALL = field.NewAsterisk(tableName) + _mapRegion.RegionID = field.NewInt32(tableName, "regionID") + _mapRegion.RegionName = field.NewString(tableName, "regionName") + _mapRegion.X = field.NewFloat64(tableName, "x") + _mapRegion.Y = field.NewFloat64(tableName, "y") + _mapRegion.Z = field.NewFloat64(tableName, "z") + _mapRegion.XMin = field.NewFloat64(tableName, "xMin") + _mapRegion.XMax = field.NewFloat64(tableName, "xMax") + _mapRegion.YMin = field.NewFloat64(tableName, "yMin") + _mapRegion.YMax = field.NewFloat64(tableName, "yMax") + _mapRegion.ZMin = field.NewFloat64(tableName, "zMin") + _mapRegion.ZMax = field.NewFloat64(tableName, "zMax") + _mapRegion.FactionID = field.NewInt32(tableName, "factionID") + _mapRegion.Nebula = field.NewInt32(tableName, "nebula") + _mapRegion.Radius = field.NewFloat64(tableName, "radius") + + _mapRegion.fillFieldMap() + + return _mapRegion +} + +type mapRegion struct { + mapRegionDo mapRegionDo + + ALL field.Asterisk + RegionID field.Int32 + RegionName field.String + X field.Float64 + Y field.Float64 + Z field.Float64 + XMin field.Float64 + XMax field.Float64 + YMin field.Float64 + YMax field.Float64 + ZMin field.Float64 + ZMax field.Float64 + FactionID field.Int32 + Nebula field.Int32 + Radius field.Float64 + + fieldMap map[string]field.Expr +} + +func (m mapRegion) Table(newTableName string) *mapRegion { + m.mapRegionDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapRegion) As(alias string) *mapRegion { + m.mapRegionDo.DO = *(m.mapRegionDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapRegion) updateTableName(table string) *mapRegion { + m.ALL = field.NewAsterisk(table) + m.RegionID = field.NewInt32(table, "regionID") + m.RegionName = field.NewString(table, "regionName") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.XMin = field.NewFloat64(table, "xMin") + m.XMax = field.NewFloat64(table, "xMax") + m.YMin = field.NewFloat64(table, "yMin") + m.YMax = field.NewFloat64(table, "yMax") + m.ZMin = field.NewFloat64(table, "zMin") + m.ZMax = field.NewFloat64(table, "zMax") + m.FactionID = field.NewInt32(table, "factionID") + m.Nebula = field.NewInt32(table, "nebula") + m.Radius = field.NewFloat64(table, "radius") + + m.fillFieldMap() + + return m +} + +func (m *mapRegion) WithContext(ctx context.Context) *mapRegionDo { + return m.mapRegionDo.WithContext(ctx) +} + +func (m mapRegion) TableName() string { return m.mapRegionDo.TableName() } + +func (m mapRegion) Alias() string { return m.mapRegionDo.Alias() } + +func (m mapRegion) Columns(cols ...field.Expr) gen.Columns { return m.mapRegionDo.Columns(cols...) } + +func (m *mapRegion) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapRegion) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 14) + m.fieldMap["regionID"] = m.RegionID + m.fieldMap["regionName"] = m.RegionName + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["xMin"] = m.XMin + m.fieldMap["xMax"] = m.XMax + m.fieldMap["yMin"] = m.YMin + m.fieldMap["yMax"] = m.YMax + m.fieldMap["zMin"] = m.ZMin + m.fieldMap["zMax"] = m.ZMax + m.fieldMap["factionID"] = m.FactionID + m.fieldMap["nebula"] = m.Nebula + m.fieldMap["radius"] = m.Radius +} + +func (m mapRegion) clone(db *gorm.DB) mapRegion { + m.mapRegionDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapRegion) replaceDB(db *gorm.DB) mapRegion { + m.mapRegionDo.ReplaceDB(db) + return m +} + +type mapRegionDo struct{ gen.DO } + +func (m mapRegionDo) Debug() *mapRegionDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapRegionDo) WithContext(ctx context.Context) *mapRegionDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapRegionDo) ReadDB() *mapRegionDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapRegionDo) WriteDB() *mapRegionDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapRegionDo) Session(config *gorm.Session) *mapRegionDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapRegionDo) Clauses(conds ...clause.Expression) *mapRegionDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapRegionDo) Returning(value interface{}, columns ...string) *mapRegionDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapRegionDo) Not(conds ...gen.Condition) *mapRegionDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapRegionDo) Or(conds ...gen.Condition) *mapRegionDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapRegionDo) Select(conds ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapRegionDo) Where(conds ...gen.Condition) *mapRegionDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapRegionDo) Order(conds ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapRegionDo) Distinct(cols ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapRegionDo) Omit(cols ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapRegionDo) Join(table schema.Tabler, on ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapRegionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapRegionDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapRegionDo) Group(cols ...field.Expr) *mapRegionDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapRegionDo) Having(conds ...gen.Condition) *mapRegionDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapRegionDo) Limit(limit int) *mapRegionDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapRegionDo) Offset(offset int) *mapRegionDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapRegionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapRegionDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapRegionDo) Unscoped() *mapRegionDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapRegionDo) Create(values ...*models.MapRegion) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapRegionDo) CreateInBatches(values []*models.MapRegion, batchSize int) error { + return m.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 (m mapRegionDo) Save(values ...*models.MapRegion) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapRegionDo) First() (*models.MapRegion, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapRegion), nil + } +} + +func (m mapRegionDo) Take() (*models.MapRegion, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapRegion), nil + } +} + +func (m mapRegionDo) Last() (*models.MapRegion, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapRegion), nil + } +} + +func (m mapRegionDo) Find() ([]*models.MapRegion, error) { + result, err := m.DO.Find() + return result.([]*models.MapRegion), err +} + +func (m mapRegionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapRegion, err error) { + buf := make([]*models.MapRegion, 0, batchSize) + err = m.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 (m mapRegionDo) FindInBatches(result *[]*models.MapRegion, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapRegionDo) Attrs(attrs ...field.AssignExpr) *mapRegionDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapRegionDo) Assign(attrs ...field.AssignExpr) *mapRegionDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapRegionDo) Joins(fields ...field.RelationField) *mapRegionDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapRegionDo) Preload(fields ...field.RelationField) *mapRegionDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapRegionDo) FirstOrInit() (*models.MapRegion, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapRegion), nil + } +} + +func (m mapRegionDo) FirstOrCreate() (*models.MapRegion, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapRegion), nil + } +} + +func (m mapRegionDo) FindByPage(offset int, limit int) (result []*models.MapRegion, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapRegionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapRegionDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapRegionDo) Delete(models ...*models.MapRegion) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapRegionDo) withDO(do gen.Dao) *mapRegionDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapsolarsystemjumps.gen.go b/models/mapsolarsystemjumps.gen.go new file mode 100644 index 0000000..e0b9d9d --- /dev/null +++ b/models/mapsolarsystemjumps.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapSolarSystemJump(db *gorm.DB, opts ...gen.DOOption) mapSolarSystemJump { + _mapSolarSystemJump := mapSolarSystemJump{} + + _mapSolarSystemJump.mapSolarSystemJumpDo.UseDB(db, opts...) + _mapSolarSystemJump.mapSolarSystemJumpDo.UseModel(&models.MapSolarSystemJump{}) + + tableName := _mapSolarSystemJump.mapSolarSystemJumpDo.TableName() + _mapSolarSystemJump.ALL = field.NewAsterisk(tableName) + _mapSolarSystemJump.FromRegionID = field.NewInt32(tableName, "fromRegionID") + _mapSolarSystemJump.FromConstellationID = field.NewInt32(tableName, "fromConstellationID") + _mapSolarSystemJump.FromSolarSystemID = field.NewInt32(tableName, "fromSolarSystemID") + _mapSolarSystemJump.ToSolarSystemID = field.NewInt32(tableName, "toSolarSystemID") + _mapSolarSystemJump.ToConstellationID = field.NewInt32(tableName, "toConstellationID") + _mapSolarSystemJump.ToRegionID = field.NewInt32(tableName, "toRegionID") + + _mapSolarSystemJump.fillFieldMap() + + return _mapSolarSystemJump +} + +type mapSolarSystemJump struct { + mapSolarSystemJumpDo mapSolarSystemJumpDo + + ALL field.Asterisk + FromRegionID field.Int32 + FromConstellationID field.Int32 + FromSolarSystemID field.Int32 + ToSolarSystemID field.Int32 + ToConstellationID field.Int32 + ToRegionID field.Int32 + + fieldMap map[string]field.Expr +} + +func (m mapSolarSystemJump) Table(newTableName string) *mapSolarSystemJump { + m.mapSolarSystemJumpDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapSolarSystemJump) As(alias string) *mapSolarSystemJump { + m.mapSolarSystemJumpDo.DO = *(m.mapSolarSystemJumpDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapSolarSystemJump) updateTableName(table string) *mapSolarSystemJump { + m.ALL = field.NewAsterisk(table) + m.FromRegionID = field.NewInt32(table, "fromRegionID") + m.FromConstellationID = field.NewInt32(table, "fromConstellationID") + m.FromSolarSystemID = field.NewInt32(table, "fromSolarSystemID") + m.ToSolarSystemID = field.NewInt32(table, "toSolarSystemID") + m.ToConstellationID = field.NewInt32(table, "toConstellationID") + m.ToRegionID = field.NewInt32(table, "toRegionID") + + m.fillFieldMap() + + return m +} + +func (m *mapSolarSystemJump) WithContext(ctx context.Context) *mapSolarSystemJumpDo { + return m.mapSolarSystemJumpDo.WithContext(ctx) +} + +func (m mapSolarSystemJump) TableName() string { return m.mapSolarSystemJumpDo.TableName() } + +func (m mapSolarSystemJump) Alias() string { return m.mapSolarSystemJumpDo.Alias() } + +func (m mapSolarSystemJump) Columns(cols ...field.Expr) gen.Columns { + return m.mapSolarSystemJumpDo.Columns(cols...) +} + +func (m *mapSolarSystemJump) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapSolarSystemJump) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 6) + m.fieldMap["fromRegionID"] = m.FromRegionID + m.fieldMap["fromConstellationID"] = m.FromConstellationID + m.fieldMap["fromSolarSystemID"] = m.FromSolarSystemID + m.fieldMap["toSolarSystemID"] = m.ToSolarSystemID + m.fieldMap["toConstellationID"] = m.ToConstellationID + m.fieldMap["toRegionID"] = m.ToRegionID +} + +func (m mapSolarSystemJump) clone(db *gorm.DB) mapSolarSystemJump { + m.mapSolarSystemJumpDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapSolarSystemJump) replaceDB(db *gorm.DB) mapSolarSystemJump { + m.mapSolarSystemJumpDo.ReplaceDB(db) + return m +} + +type mapSolarSystemJumpDo struct{ gen.DO } + +func (m mapSolarSystemJumpDo) Debug() *mapSolarSystemJumpDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapSolarSystemJumpDo) WithContext(ctx context.Context) *mapSolarSystemJumpDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapSolarSystemJumpDo) ReadDB() *mapSolarSystemJumpDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapSolarSystemJumpDo) WriteDB() *mapSolarSystemJumpDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapSolarSystemJumpDo) Session(config *gorm.Session) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapSolarSystemJumpDo) Clauses(conds ...clause.Expression) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapSolarSystemJumpDo) Returning(value interface{}, columns ...string) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapSolarSystemJumpDo) Not(conds ...gen.Condition) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapSolarSystemJumpDo) Or(conds ...gen.Condition) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapSolarSystemJumpDo) Select(conds ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapSolarSystemJumpDo) Where(conds ...gen.Condition) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapSolarSystemJumpDo) Order(conds ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapSolarSystemJumpDo) Distinct(cols ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapSolarSystemJumpDo) Omit(cols ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapSolarSystemJumpDo) Join(table schema.Tabler, on ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapSolarSystemJumpDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapSolarSystemJumpDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapSolarSystemJumpDo) Group(cols ...field.Expr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapSolarSystemJumpDo) Having(conds ...gen.Condition) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapSolarSystemJumpDo) Limit(limit int) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapSolarSystemJumpDo) Offset(offset int) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapSolarSystemJumpDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapSolarSystemJumpDo) Unscoped() *mapSolarSystemJumpDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapSolarSystemJumpDo) Create(values ...*models.MapSolarSystemJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapSolarSystemJumpDo) CreateInBatches(values []*models.MapSolarSystemJump, batchSize int) error { + return m.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 (m mapSolarSystemJumpDo) Save(values ...*models.MapSolarSystemJump) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapSolarSystemJumpDo) First() (*models.MapSolarSystemJump, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystemJump), nil + } +} + +func (m mapSolarSystemJumpDo) Take() (*models.MapSolarSystemJump, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystemJump), nil + } +} + +func (m mapSolarSystemJumpDo) Last() (*models.MapSolarSystemJump, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystemJump), nil + } +} + +func (m mapSolarSystemJumpDo) Find() ([]*models.MapSolarSystemJump, error) { + result, err := m.DO.Find() + return result.([]*models.MapSolarSystemJump), err +} + +func (m mapSolarSystemJumpDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapSolarSystemJump, err error) { + buf := make([]*models.MapSolarSystemJump, 0, batchSize) + err = m.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 (m mapSolarSystemJumpDo) FindInBatches(result *[]*models.MapSolarSystemJump, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapSolarSystemJumpDo) Attrs(attrs ...field.AssignExpr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapSolarSystemJumpDo) Assign(attrs ...field.AssignExpr) *mapSolarSystemJumpDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapSolarSystemJumpDo) Joins(fields ...field.RelationField) *mapSolarSystemJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapSolarSystemJumpDo) Preload(fields ...field.RelationField) *mapSolarSystemJumpDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapSolarSystemJumpDo) FirstOrInit() (*models.MapSolarSystemJump, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystemJump), nil + } +} + +func (m mapSolarSystemJumpDo) FirstOrCreate() (*models.MapSolarSystemJump, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystemJump), nil + } +} + +func (m mapSolarSystemJumpDo) FindByPage(offset int, limit int) (result []*models.MapSolarSystemJump, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapSolarSystemJumpDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapSolarSystemJumpDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapSolarSystemJumpDo) Delete(models ...*models.MapSolarSystemJump) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapSolarSystemJumpDo) withDO(do gen.Dao) *mapSolarSystemJumpDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapsolarsystems.gen.go b/models/mapsolarsystems.gen.go new file mode 100644 index 0000000..a1e72e8 --- /dev/null +++ b/models/mapsolarsystems.gen.go @@ -0,0 +1,431 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapSolarSystem(db *gorm.DB, opts ...gen.DOOption) mapSolarSystem { + _mapSolarSystem := mapSolarSystem{} + + _mapSolarSystem.mapSolarSystemDo.UseDB(db, opts...) + _mapSolarSystem.mapSolarSystemDo.UseModel(&models.MapSolarSystem{}) + + tableName := _mapSolarSystem.mapSolarSystemDo.TableName() + _mapSolarSystem.ALL = field.NewAsterisk(tableName) + _mapSolarSystem.RegionID = field.NewInt32(tableName, "regionID") + _mapSolarSystem.ConstellationID = field.NewInt32(tableName, "constellationID") + _mapSolarSystem.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _mapSolarSystem.SolarSystemName = field.NewString(tableName, "solarSystemName") + _mapSolarSystem.X = field.NewFloat64(tableName, "x") + _mapSolarSystem.Y = field.NewFloat64(tableName, "y") + _mapSolarSystem.Z = field.NewFloat64(tableName, "z") + _mapSolarSystem.XMin = field.NewFloat64(tableName, "xMin") + _mapSolarSystem.XMax = field.NewFloat64(tableName, "xMax") + _mapSolarSystem.YMin = field.NewFloat64(tableName, "yMin") + _mapSolarSystem.YMax = field.NewFloat64(tableName, "yMax") + _mapSolarSystem.ZMin = field.NewFloat64(tableName, "zMin") + _mapSolarSystem.ZMax = field.NewFloat64(tableName, "zMax") + _mapSolarSystem.Luminosity = field.NewFloat64(tableName, "luminosity") + _mapSolarSystem.Border = field.NewBool(tableName, "border") + _mapSolarSystem.Fringe = field.NewBool(tableName, "fringe") + _mapSolarSystem.Corridor = field.NewBool(tableName, "corridor") + _mapSolarSystem.Hub = field.NewBool(tableName, "hub") + _mapSolarSystem.International = field.NewBool(tableName, "international") + _mapSolarSystem.Regional = field.NewBool(tableName, "regional") + _mapSolarSystem.Constellation = field.NewBool(tableName, "constellation") + _mapSolarSystem.Security = field.NewFloat64(tableName, "security") + _mapSolarSystem.FactionID = field.NewInt32(tableName, "factionID") + _mapSolarSystem.Radius = field.NewFloat64(tableName, "radius") + _mapSolarSystem.SunTypeID = field.NewInt32(tableName, "sunTypeID") + _mapSolarSystem.SecurityClass = field.NewString(tableName, "securityClass") + + _mapSolarSystem.fillFieldMap() + + return _mapSolarSystem +} + +type mapSolarSystem struct { + mapSolarSystemDo mapSolarSystemDo + + ALL field.Asterisk + RegionID field.Int32 + ConstellationID field.Int32 + SolarSystemID field.Int32 + SolarSystemName field.String + X field.Float64 + Y field.Float64 + Z field.Float64 + XMin field.Float64 + XMax field.Float64 + YMin field.Float64 + YMax field.Float64 + ZMin field.Float64 + ZMax field.Float64 + Luminosity field.Float64 + Border field.Bool + Fringe field.Bool + Corridor field.Bool + Hub field.Bool + International field.Bool + Regional field.Bool + Constellation field.Bool + Security field.Float64 + FactionID field.Int32 + Radius field.Float64 + SunTypeID field.Int32 + SecurityClass field.String + + fieldMap map[string]field.Expr +} + +func (m mapSolarSystem) Table(newTableName string) *mapSolarSystem { + m.mapSolarSystemDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapSolarSystem) As(alias string) *mapSolarSystem { + m.mapSolarSystemDo.DO = *(m.mapSolarSystemDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapSolarSystem) updateTableName(table string) *mapSolarSystem { + m.ALL = field.NewAsterisk(table) + m.RegionID = field.NewInt32(table, "regionID") + m.ConstellationID = field.NewInt32(table, "constellationID") + m.SolarSystemID = field.NewInt32(table, "solarSystemID") + m.SolarSystemName = field.NewString(table, "solarSystemName") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.XMin = field.NewFloat64(table, "xMin") + m.XMax = field.NewFloat64(table, "xMax") + m.YMin = field.NewFloat64(table, "yMin") + m.YMax = field.NewFloat64(table, "yMax") + m.ZMin = field.NewFloat64(table, "zMin") + m.ZMax = field.NewFloat64(table, "zMax") + m.Luminosity = field.NewFloat64(table, "luminosity") + m.Border = field.NewBool(table, "border") + m.Fringe = field.NewBool(table, "fringe") + m.Corridor = field.NewBool(table, "corridor") + m.Hub = field.NewBool(table, "hub") + m.International = field.NewBool(table, "international") + m.Regional = field.NewBool(table, "regional") + m.Constellation = field.NewBool(table, "constellation") + m.Security = field.NewFloat64(table, "security") + m.FactionID = field.NewInt32(table, "factionID") + m.Radius = field.NewFloat64(table, "radius") + m.SunTypeID = field.NewInt32(table, "sunTypeID") + m.SecurityClass = field.NewString(table, "securityClass") + + m.fillFieldMap() + + return m +} + +func (m *mapSolarSystem) WithContext(ctx context.Context) *mapSolarSystemDo { + return m.mapSolarSystemDo.WithContext(ctx) +} + +func (m mapSolarSystem) TableName() string { return m.mapSolarSystemDo.TableName() } + +func (m mapSolarSystem) Alias() string { return m.mapSolarSystemDo.Alias() } + +func (m mapSolarSystem) Columns(cols ...field.Expr) gen.Columns { + return m.mapSolarSystemDo.Columns(cols...) +} + +func (m *mapSolarSystem) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapSolarSystem) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 26) + m.fieldMap["regionID"] = m.RegionID + m.fieldMap["constellationID"] = m.ConstellationID + m.fieldMap["solarSystemID"] = m.SolarSystemID + m.fieldMap["solarSystemName"] = m.SolarSystemName + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["xMin"] = m.XMin + m.fieldMap["xMax"] = m.XMax + m.fieldMap["yMin"] = m.YMin + m.fieldMap["yMax"] = m.YMax + m.fieldMap["zMin"] = m.ZMin + m.fieldMap["zMax"] = m.ZMax + m.fieldMap["luminosity"] = m.Luminosity + m.fieldMap["border"] = m.Border + m.fieldMap["fringe"] = m.Fringe + m.fieldMap["corridor"] = m.Corridor + m.fieldMap["hub"] = m.Hub + m.fieldMap["international"] = m.International + m.fieldMap["regional"] = m.Regional + m.fieldMap["constellation"] = m.Constellation + m.fieldMap["security"] = m.Security + m.fieldMap["factionID"] = m.FactionID + m.fieldMap["radius"] = m.Radius + m.fieldMap["sunTypeID"] = m.SunTypeID + m.fieldMap["securityClass"] = m.SecurityClass +} + +func (m mapSolarSystem) clone(db *gorm.DB) mapSolarSystem { + m.mapSolarSystemDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapSolarSystem) replaceDB(db *gorm.DB) mapSolarSystem { + m.mapSolarSystemDo.ReplaceDB(db) + return m +} + +type mapSolarSystemDo struct{ gen.DO } + +func (m mapSolarSystemDo) Debug() *mapSolarSystemDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapSolarSystemDo) WithContext(ctx context.Context) *mapSolarSystemDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapSolarSystemDo) ReadDB() *mapSolarSystemDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapSolarSystemDo) WriteDB() *mapSolarSystemDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapSolarSystemDo) Session(config *gorm.Session) *mapSolarSystemDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapSolarSystemDo) Clauses(conds ...clause.Expression) *mapSolarSystemDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapSolarSystemDo) Returning(value interface{}, columns ...string) *mapSolarSystemDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapSolarSystemDo) Not(conds ...gen.Condition) *mapSolarSystemDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapSolarSystemDo) Or(conds ...gen.Condition) *mapSolarSystemDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapSolarSystemDo) Select(conds ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapSolarSystemDo) Where(conds ...gen.Condition) *mapSolarSystemDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapSolarSystemDo) Order(conds ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapSolarSystemDo) Distinct(cols ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapSolarSystemDo) Omit(cols ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapSolarSystemDo) Join(table schema.Tabler, on ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapSolarSystemDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapSolarSystemDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapSolarSystemDo) Group(cols ...field.Expr) *mapSolarSystemDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapSolarSystemDo) Having(conds ...gen.Condition) *mapSolarSystemDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapSolarSystemDo) Limit(limit int) *mapSolarSystemDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapSolarSystemDo) Offset(offset int) *mapSolarSystemDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapSolarSystemDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapSolarSystemDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapSolarSystemDo) Unscoped() *mapSolarSystemDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapSolarSystemDo) Create(values ...*models.MapSolarSystem) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapSolarSystemDo) CreateInBatches(values []*models.MapSolarSystem, batchSize int) error { + return m.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 (m mapSolarSystemDo) Save(values ...*models.MapSolarSystem) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapSolarSystemDo) First() (*models.MapSolarSystem, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystem), nil + } +} + +func (m mapSolarSystemDo) Take() (*models.MapSolarSystem, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystem), nil + } +} + +func (m mapSolarSystemDo) Last() (*models.MapSolarSystem, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystem), nil + } +} + +func (m mapSolarSystemDo) Find() ([]*models.MapSolarSystem, error) { + result, err := m.DO.Find() + return result.([]*models.MapSolarSystem), err +} + +func (m mapSolarSystemDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapSolarSystem, err error) { + buf := make([]*models.MapSolarSystem, 0, batchSize) + err = m.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 (m mapSolarSystemDo) FindInBatches(result *[]*models.MapSolarSystem, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapSolarSystemDo) Attrs(attrs ...field.AssignExpr) *mapSolarSystemDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapSolarSystemDo) Assign(attrs ...field.AssignExpr) *mapSolarSystemDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapSolarSystemDo) Joins(fields ...field.RelationField) *mapSolarSystemDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapSolarSystemDo) Preload(fields ...field.RelationField) *mapSolarSystemDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapSolarSystemDo) FirstOrInit() (*models.MapSolarSystem, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystem), nil + } +} + +func (m mapSolarSystemDo) FirstOrCreate() (*models.MapSolarSystem, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapSolarSystem), nil + } +} + +func (m mapSolarSystemDo) FindByPage(offset int, limit int) (result []*models.MapSolarSystem, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapSolarSystemDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapSolarSystemDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapSolarSystemDo) Delete(models ...*models.MapSolarSystem) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapSolarSystemDo) withDO(do gen.Dao) *mapSolarSystemDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/mapuniverse.gen.go b/models/mapuniverse.gen.go new file mode 100644 index 0000000..758331c --- /dev/null +++ b/models/mapuniverse.gen.go @@ -0,0 +1,373 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newMapUniverse(db *gorm.DB, opts ...gen.DOOption) mapUniverse { + _mapUniverse := mapUniverse{} + + _mapUniverse.mapUniverseDo.UseDB(db, opts...) + _mapUniverse.mapUniverseDo.UseModel(&models.MapUniverse{}) + + tableName := _mapUniverse.mapUniverseDo.TableName() + _mapUniverse.ALL = field.NewAsterisk(tableName) + _mapUniverse.UniverseID = field.NewInt32(tableName, "universeID") + _mapUniverse.UniverseName = field.NewString(tableName, "universeName") + _mapUniverse.X = field.NewFloat64(tableName, "x") + _mapUniverse.Y = field.NewFloat64(tableName, "y") + _mapUniverse.Z = field.NewFloat64(tableName, "z") + _mapUniverse.XMin = field.NewFloat64(tableName, "xMin") + _mapUniverse.XMax = field.NewFloat64(tableName, "xMax") + _mapUniverse.YMin = field.NewFloat64(tableName, "yMin") + _mapUniverse.YMax = field.NewFloat64(tableName, "yMax") + _mapUniverse.ZMin = field.NewFloat64(tableName, "zMin") + _mapUniverse.ZMax = field.NewFloat64(tableName, "zMax") + _mapUniverse.Radius = field.NewFloat64(tableName, "radius") + + _mapUniverse.fillFieldMap() + + return _mapUniverse +} + +type mapUniverse struct { + mapUniverseDo mapUniverseDo + + ALL field.Asterisk + UniverseID field.Int32 + UniverseName field.String + X field.Float64 + Y field.Float64 + Z field.Float64 + XMin field.Float64 + XMax field.Float64 + YMin field.Float64 + YMax field.Float64 + ZMin field.Float64 + ZMax field.Float64 + Radius field.Float64 + + fieldMap map[string]field.Expr +} + +func (m mapUniverse) Table(newTableName string) *mapUniverse { + m.mapUniverseDo.UseTable(newTableName) + return m.updateTableName(newTableName) +} + +func (m mapUniverse) As(alias string) *mapUniverse { + m.mapUniverseDo.DO = *(m.mapUniverseDo.As(alias).(*gen.DO)) + return m.updateTableName(alias) +} + +func (m *mapUniverse) updateTableName(table string) *mapUniverse { + m.ALL = field.NewAsterisk(table) + m.UniverseID = field.NewInt32(table, "universeID") + m.UniverseName = field.NewString(table, "universeName") + m.X = field.NewFloat64(table, "x") + m.Y = field.NewFloat64(table, "y") + m.Z = field.NewFloat64(table, "z") + m.XMin = field.NewFloat64(table, "xMin") + m.XMax = field.NewFloat64(table, "xMax") + m.YMin = field.NewFloat64(table, "yMin") + m.YMax = field.NewFloat64(table, "yMax") + m.ZMin = field.NewFloat64(table, "zMin") + m.ZMax = field.NewFloat64(table, "zMax") + m.Radius = field.NewFloat64(table, "radius") + + m.fillFieldMap() + + return m +} + +func (m *mapUniverse) WithContext(ctx context.Context) *mapUniverseDo { + return m.mapUniverseDo.WithContext(ctx) +} + +func (m mapUniverse) TableName() string { return m.mapUniverseDo.TableName() } + +func (m mapUniverse) Alias() string { return m.mapUniverseDo.Alias() } + +func (m mapUniverse) Columns(cols ...field.Expr) gen.Columns { return m.mapUniverseDo.Columns(cols...) } + +func (m *mapUniverse) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := m.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (m *mapUniverse) fillFieldMap() { + m.fieldMap = make(map[string]field.Expr, 12) + m.fieldMap["universeID"] = m.UniverseID + m.fieldMap["universeName"] = m.UniverseName + m.fieldMap["x"] = m.X + m.fieldMap["y"] = m.Y + m.fieldMap["z"] = m.Z + m.fieldMap["xMin"] = m.XMin + m.fieldMap["xMax"] = m.XMax + m.fieldMap["yMin"] = m.YMin + m.fieldMap["yMax"] = m.YMax + m.fieldMap["zMin"] = m.ZMin + m.fieldMap["zMax"] = m.ZMax + m.fieldMap["radius"] = m.Radius +} + +func (m mapUniverse) clone(db *gorm.DB) mapUniverse { + m.mapUniverseDo.ReplaceConnPool(db.Statement.ConnPool) + return m +} + +func (m mapUniverse) replaceDB(db *gorm.DB) mapUniverse { + m.mapUniverseDo.ReplaceDB(db) + return m +} + +type mapUniverseDo struct{ gen.DO } + +func (m mapUniverseDo) Debug() *mapUniverseDo { + return m.withDO(m.DO.Debug()) +} + +func (m mapUniverseDo) WithContext(ctx context.Context) *mapUniverseDo { + return m.withDO(m.DO.WithContext(ctx)) +} + +func (m mapUniverseDo) ReadDB() *mapUniverseDo { + return m.Clauses(dbresolver.Read) +} + +func (m mapUniverseDo) WriteDB() *mapUniverseDo { + return m.Clauses(dbresolver.Write) +} + +func (m mapUniverseDo) Session(config *gorm.Session) *mapUniverseDo { + return m.withDO(m.DO.Session(config)) +} + +func (m mapUniverseDo) Clauses(conds ...clause.Expression) *mapUniverseDo { + return m.withDO(m.DO.Clauses(conds...)) +} + +func (m mapUniverseDo) Returning(value interface{}, columns ...string) *mapUniverseDo { + return m.withDO(m.DO.Returning(value, columns...)) +} + +func (m mapUniverseDo) Not(conds ...gen.Condition) *mapUniverseDo { + return m.withDO(m.DO.Not(conds...)) +} + +func (m mapUniverseDo) Or(conds ...gen.Condition) *mapUniverseDo { + return m.withDO(m.DO.Or(conds...)) +} + +func (m mapUniverseDo) Select(conds ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Select(conds...)) +} + +func (m mapUniverseDo) Where(conds ...gen.Condition) *mapUniverseDo { + return m.withDO(m.DO.Where(conds...)) +} + +func (m mapUniverseDo) Order(conds ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Order(conds...)) +} + +func (m mapUniverseDo) Distinct(cols ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Distinct(cols...)) +} + +func (m mapUniverseDo) Omit(cols ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Omit(cols...)) +} + +func (m mapUniverseDo) Join(table schema.Tabler, on ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Join(table, on...)) +} + +func (m mapUniverseDo) LeftJoin(table schema.Tabler, on ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.LeftJoin(table, on...)) +} + +func (m mapUniverseDo) RightJoin(table schema.Tabler, on ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.RightJoin(table, on...)) +} + +func (m mapUniverseDo) Group(cols ...field.Expr) *mapUniverseDo { + return m.withDO(m.DO.Group(cols...)) +} + +func (m mapUniverseDo) Having(conds ...gen.Condition) *mapUniverseDo { + return m.withDO(m.DO.Having(conds...)) +} + +func (m mapUniverseDo) Limit(limit int) *mapUniverseDo { + return m.withDO(m.DO.Limit(limit)) +} + +func (m mapUniverseDo) Offset(offset int) *mapUniverseDo { + return m.withDO(m.DO.Offset(offset)) +} + +func (m mapUniverseDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *mapUniverseDo { + return m.withDO(m.DO.Scopes(funcs...)) +} + +func (m mapUniverseDo) Unscoped() *mapUniverseDo { + return m.withDO(m.DO.Unscoped()) +} + +func (m mapUniverseDo) Create(values ...*models.MapUniverse) error { + if len(values) == 0 { + return nil + } + return m.DO.Create(values) +} + +func (m mapUniverseDo) CreateInBatches(values []*models.MapUniverse, batchSize int) error { + return m.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 (m mapUniverseDo) Save(values ...*models.MapUniverse) error { + if len(values) == 0 { + return nil + } + return m.DO.Save(values) +} + +func (m mapUniverseDo) First() (*models.MapUniverse, error) { + if result, err := m.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.MapUniverse), nil + } +} + +func (m mapUniverseDo) Take() (*models.MapUniverse, error) { + if result, err := m.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.MapUniverse), nil + } +} + +func (m mapUniverseDo) Last() (*models.MapUniverse, error) { + if result, err := m.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.MapUniverse), nil + } +} + +func (m mapUniverseDo) Find() ([]*models.MapUniverse, error) { + result, err := m.DO.Find() + return result.([]*models.MapUniverse), err +} + +func (m mapUniverseDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.MapUniverse, err error) { + buf := make([]*models.MapUniverse, 0, batchSize) + err = m.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 (m mapUniverseDo) FindInBatches(result *[]*models.MapUniverse, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return m.DO.FindInBatches(result, batchSize, fc) +} + +func (m mapUniverseDo) Attrs(attrs ...field.AssignExpr) *mapUniverseDo { + return m.withDO(m.DO.Attrs(attrs...)) +} + +func (m mapUniverseDo) Assign(attrs ...field.AssignExpr) *mapUniverseDo { + return m.withDO(m.DO.Assign(attrs...)) +} + +func (m mapUniverseDo) Joins(fields ...field.RelationField) *mapUniverseDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Joins(_f)) + } + return &m +} + +func (m mapUniverseDo) Preload(fields ...field.RelationField) *mapUniverseDo { + for _, _f := range fields { + m = *m.withDO(m.DO.Preload(_f)) + } + return &m +} + +func (m mapUniverseDo) FirstOrInit() (*models.MapUniverse, error) { + if result, err := m.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.MapUniverse), nil + } +} + +func (m mapUniverseDo) FirstOrCreate() (*models.MapUniverse, error) { + if result, err := m.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.MapUniverse), nil + } +} + +func (m mapUniverseDo) FindByPage(offset int, limit int) (result []*models.MapUniverse, count int64, err error) { + result, err = m.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 = m.Offset(-1).Limit(-1).Count() + return +} + +func (m mapUniverseDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = m.Count() + if err != nil { + return + } + + err = m.Offset(offset).Limit(limit).Scan(result) + return +} + +func (m mapUniverseDo) Scan(result interface{}) (err error) { + return m.DO.Scan(result) +} + +func (m mapUniverseDo) Delete(models ...*models.MapUniverse) (result gen.ResultInfo, err error) { + return m.DO.Delete(models) +} + +func (m *mapUniverseDo) withDO(do gen.Dao) *mapUniverseDo { + m.DO = *do.(*gen.DO) + return m +} diff --git a/models/planetschematics.gen.go b/models/planetschematics.gen.go new file mode 100644 index 0000000..6c017f2 --- /dev/null +++ b/models/planetschematics.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newPlanetSchematic(db *gorm.DB, opts ...gen.DOOption) planetSchematic { + _planetSchematic := planetSchematic{} + + _planetSchematic.planetSchematicDo.UseDB(db, opts...) + _planetSchematic.planetSchematicDo.UseModel(&models.PlanetSchematic{}) + + tableName := _planetSchematic.planetSchematicDo.TableName() + _planetSchematic.ALL = field.NewAsterisk(tableName) + _planetSchematic.SchematicID = field.NewInt32(tableName, "schematicID") + _planetSchematic.SchematicName = field.NewString(tableName, "schematicName") + _planetSchematic.CycleTime = field.NewInt32(tableName, "cycleTime") + + _planetSchematic.fillFieldMap() + + return _planetSchematic +} + +type planetSchematic struct { + planetSchematicDo planetSchematicDo + + ALL field.Asterisk + SchematicID field.Int32 + SchematicName field.String + CycleTime field.Int32 + + fieldMap map[string]field.Expr +} + +func (p planetSchematic) Table(newTableName string) *planetSchematic { + p.planetSchematicDo.UseTable(newTableName) + return p.updateTableName(newTableName) +} + +func (p planetSchematic) As(alias string) *planetSchematic { + p.planetSchematicDo.DO = *(p.planetSchematicDo.As(alias).(*gen.DO)) + return p.updateTableName(alias) +} + +func (p *planetSchematic) updateTableName(table string) *planetSchematic { + p.ALL = field.NewAsterisk(table) + p.SchematicID = field.NewInt32(table, "schematicID") + p.SchematicName = field.NewString(table, "schematicName") + p.CycleTime = field.NewInt32(table, "cycleTime") + + p.fillFieldMap() + + return p +} + +func (p *planetSchematic) WithContext(ctx context.Context) *planetSchematicDo { + return p.planetSchematicDo.WithContext(ctx) +} + +func (p planetSchematic) TableName() string { return p.planetSchematicDo.TableName() } + +func (p planetSchematic) Alias() string { return p.planetSchematicDo.Alias() } + +func (p planetSchematic) Columns(cols ...field.Expr) gen.Columns { + return p.planetSchematicDo.Columns(cols...) +} + +func (p *planetSchematic) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := p.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (p *planetSchematic) fillFieldMap() { + p.fieldMap = make(map[string]field.Expr, 3) + p.fieldMap["schematicID"] = p.SchematicID + p.fieldMap["schematicName"] = p.SchematicName + p.fieldMap["cycleTime"] = p.CycleTime +} + +func (p planetSchematic) clone(db *gorm.DB) planetSchematic { + p.planetSchematicDo.ReplaceConnPool(db.Statement.ConnPool) + return p +} + +func (p planetSchematic) replaceDB(db *gorm.DB) planetSchematic { + p.planetSchematicDo.ReplaceDB(db) + return p +} + +type planetSchematicDo struct{ gen.DO } + +func (p planetSchematicDo) Debug() *planetSchematicDo { + return p.withDO(p.DO.Debug()) +} + +func (p planetSchematicDo) WithContext(ctx context.Context) *planetSchematicDo { + return p.withDO(p.DO.WithContext(ctx)) +} + +func (p planetSchematicDo) ReadDB() *planetSchematicDo { + return p.Clauses(dbresolver.Read) +} + +func (p planetSchematicDo) WriteDB() *planetSchematicDo { + return p.Clauses(dbresolver.Write) +} + +func (p planetSchematicDo) Session(config *gorm.Session) *planetSchematicDo { + return p.withDO(p.DO.Session(config)) +} + +func (p planetSchematicDo) Clauses(conds ...clause.Expression) *planetSchematicDo { + return p.withDO(p.DO.Clauses(conds...)) +} + +func (p planetSchematicDo) Returning(value interface{}, columns ...string) *planetSchematicDo { + return p.withDO(p.DO.Returning(value, columns...)) +} + +func (p planetSchematicDo) Not(conds ...gen.Condition) *planetSchematicDo { + return p.withDO(p.DO.Not(conds...)) +} + +func (p planetSchematicDo) Or(conds ...gen.Condition) *planetSchematicDo { + return p.withDO(p.DO.Or(conds...)) +} + +func (p planetSchematicDo) Select(conds ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Select(conds...)) +} + +func (p planetSchematicDo) Where(conds ...gen.Condition) *planetSchematicDo { + return p.withDO(p.DO.Where(conds...)) +} + +func (p planetSchematicDo) Order(conds ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Order(conds...)) +} + +func (p planetSchematicDo) Distinct(cols ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Distinct(cols...)) +} + +func (p planetSchematicDo) Omit(cols ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Omit(cols...)) +} + +func (p planetSchematicDo) Join(table schema.Tabler, on ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Join(table, on...)) +} + +func (p planetSchematicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.LeftJoin(table, on...)) +} + +func (p planetSchematicDo) RightJoin(table schema.Tabler, on ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.RightJoin(table, on...)) +} + +func (p planetSchematicDo) Group(cols ...field.Expr) *planetSchematicDo { + return p.withDO(p.DO.Group(cols...)) +} + +func (p planetSchematicDo) Having(conds ...gen.Condition) *planetSchematicDo { + return p.withDO(p.DO.Having(conds...)) +} + +func (p planetSchematicDo) Limit(limit int) *planetSchematicDo { + return p.withDO(p.DO.Limit(limit)) +} + +func (p planetSchematicDo) Offset(offset int) *planetSchematicDo { + return p.withDO(p.DO.Offset(offset)) +} + +func (p planetSchematicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *planetSchematicDo { + return p.withDO(p.DO.Scopes(funcs...)) +} + +func (p planetSchematicDo) Unscoped() *planetSchematicDo { + return p.withDO(p.DO.Unscoped()) +} + +func (p planetSchematicDo) Create(values ...*models.PlanetSchematic) error { + if len(values) == 0 { + return nil + } + return p.DO.Create(values) +} + +func (p planetSchematicDo) CreateInBatches(values []*models.PlanetSchematic, batchSize int) error { + return p.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 (p planetSchematicDo) Save(values ...*models.PlanetSchematic) error { + if len(values) == 0 { + return nil + } + return p.DO.Save(values) +} + +func (p planetSchematicDo) First() (*models.PlanetSchematic, error) { + if result, err := p.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematic), nil + } +} + +func (p planetSchematicDo) Take() (*models.PlanetSchematic, error) { + if result, err := p.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematic), nil + } +} + +func (p planetSchematicDo) Last() (*models.PlanetSchematic, error) { + if result, err := p.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematic), nil + } +} + +func (p planetSchematicDo) Find() ([]*models.PlanetSchematic, error) { + result, err := p.DO.Find() + return result.([]*models.PlanetSchematic), err +} + +func (p planetSchematicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.PlanetSchematic, err error) { + buf := make([]*models.PlanetSchematic, 0, batchSize) + err = p.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 (p planetSchematicDo) FindInBatches(result *[]*models.PlanetSchematic, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return p.DO.FindInBatches(result, batchSize, fc) +} + +func (p planetSchematicDo) Attrs(attrs ...field.AssignExpr) *planetSchematicDo { + return p.withDO(p.DO.Attrs(attrs...)) +} + +func (p planetSchematicDo) Assign(attrs ...field.AssignExpr) *planetSchematicDo { + return p.withDO(p.DO.Assign(attrs...)) +} + +func (p planetSchematicDo) Joins(fields ...field.RelationField) *planetSchematicDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Joins(_f)) + } + return &p +} + +func (p planetSchematicDo) Preload(fields ...field.RelationField) *planetSchematicDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Preload(_f)) + } + return &p +} + +func (p planetSchematicDo) FirstOrInit() (*models.PlanetSchematic, error) { + if result, err := p.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematic), nil + } +} + +func (p planetSchematicDo) FirstOrCreate() (*models.PlanetSchematic, error) { + if result, err := p.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematic), nil + } +} + +func (p planetSchematicDo) FindByPage(offset int, limit int) (result []*models.PlanetSchematic, count int64, err error) { + result, err = p.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 = p.Offset(-1).Limit(-1).Count() + return +} + +func (p planetSchematicDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = p.Count() + if err != nil { + return + } + + err = p.Offset(offset).Limit(limit).Scan(result) + return +} + +func (p planetSchematicDo) Scan(result interface{}) (err error) { + return p.DO.Scan(result) +} + +func (p planetSchematicDo) Delete(models ...*models.PlanetSchematic) (result gen.ResultInfo, err error) { + return p.DO.Delete(models) +} + +func (p *planetSchematicDo) withDO(do gen.Dao) *planetSchematicDo { + p.DO = *do.(*gen.DO) + return p +} diff --git a/models/planetschematicspinmap.gen.go b/models/planetschematicspinmap.gen.go new file mode 100644 index 0000000..9850274 --- /dev/null +++ b/models/planetschematicspinmap.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newPlanetSchematicsPinMap(db *gorm.DB, opts ...gen.DOOption) planetSchematicsPinMap { + _planetSchematicsPinMap := planetSchematicsPinMap{} + + _planetSchematicsPinMap.planetSchematicsPinMapDo.UseDB(db, opts...) + _planetSchematicsPinMap.planetSchematicsPinMapDo.UseModel(&models.PlanetSchematicsPinMap{}) + + tableName := _planetSchematicsPinMap.planetSchematicsPinMapDo.TableName() + _planetSchematicsPinMap.ALL = field.NewAsterisk(tableName) + _planetSchematicsPinMap.SchematicID = field.NewInt32(tableName, "schematicID") + _planetSchematicsPinMap.PinTypeID = field.NewInt32(tableName, "pinTypeID") + + _planetSchematicsPinMap.fillFieldMap() + + return _planetSchematicsPinMap +} + +type planetSchematicsPinMap struct { + planetSchematicsPinMapDo planetSchematicsPinMapDo + + ALL field.Asterisk + SchematicID field.Int32 + PinTypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (p planetSchematicsPinMap) Table(newTableName string) *planetSchematicsPinMap { + p.planetSchematicsPinMapDo.UseTable(newTableName) + return p.updateTableName(newTableName) +} + +func (p planetSchematicsPinMap) As(alias string) *planetSchematicsPinMap { + p.planetSchematicsPinMapDo.DO = *(p.planetSchematicsPinMapDo.As(alias).(*gen.DO)) + return p.updateTableName(alias) +} + +func (p *planetSchematicsPinMap) updateTableName(table string) *planetSchematicsPinMap { + p.ALL = field.NewAsterisk(table) + p.SchematicID = field.NewInt32(table, "schematicID") + p.PinTypeID = field.NewInt32(table, "pinTypeID") + + p.fillFieldMap() + + return p +} + +func (p *planetSchematicsPinMap) WithContext(ctx context.Context) *planetSchematicsPinMapDo { + return p.planetSchematicsPinMapDo.WithContext(ctx) +} + +func (p planetSchematicsPinMap) TableName() string { return p.planetSchematicsPinMapDo.TableName() } + +func (p planetSchematicsPinMap) Alias() string { return p.planetSchematicsPinMapDo.Alias() } + +func (p planetSchematicsPinMap) Columns(cols ...field.Expr) gen.Columns { + return p.planetSchematicsPinMapDo.Columns(cols...) +} + +func (p *planetSchematicsPinMap) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := p.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (p *planetSchematicsPinMap) fillFieldMap() { + p.fieldMap = make(map[string]field.Expr, 2) + p.fieldMap["schematicID"] = p.SchematicID + p.fieldMap["pinTypeID"] = p.PinTypeID +} + +func (p planetSchematicsPinMap) clone(db *gorm.DB) planetSchematicsPinMap { + p.planetSchematicsPinMapDo.ReplaceConnPool(db.Statement.ConnPool) + return p +} + +func (p planetSchematicsPinMap) replaceDB(db *gorm.DB) planetSchematicsPinMap { + p.planetSchematicsPinMapDo.ReplaceDB(db) + return p +} + +type planetSchematicsPinMapDo struct{ gen.DO } + +func (p planetSchematicsPinMapDo) Debug() *planetSchematicsPinMapDo { + return p.withDO(p.DO.Debug()) +} + +func (p planetSchematicsPinMapDo) WithContext(ctx context.Context) *planetSchematicsPinMapDo { + return p.withDO(p.DO.WithContext(ctx)) +} + +func (p planetSchematicsPinMapDo) ReadDB() *planetSchematicsPinMapDo { + return p.Clauses(dbresolver.Read) +} + +func (p planetSchematicsPinMapDo) WriteDB() *planetSchematicsPinMapDo { + return p.Clauses(dbresolver.Write) +} + +func (p planetSchematicsPinMapDo) Session(config *gorm.Session) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Session(config)) +} + +func (p planetSchematicsPinMapDo) Clauses(conds ...clause.Expression) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Clauses(conds...)) +} + +func (p planetSchematicsPinMapDo) Returning(value interface{}, columns ...string) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Returning(value, columns...)) +} + +func (p planetSchematicsPinMapDo) Not(conds ...gen.Condition) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Not(conds...)) +} + +func (p planetSchematicsPinMapDo) Or(conds ...gen.Condition) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Or(conds...)) +} + +func (p planetSchematicsPinMapDo) Select(conds ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Select(conds...)) +} + +func (p planetSchematicsPinMapDo) Where(conds ...gen.Condition) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Where(conds...)) +} + +func (p planetSchematicsPinMapDo) Order(conds ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Order(conds...)) +} + +func (p planetSchematicsPinMapDo) Distinct(cols ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Distinct(cols...)) +} + +func (p planetSchematicsPinMapDo) Omit(cols ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Omit(cols...)) +} + +func (p planetSchematicsPinMapDo) Join(table schema.Tabler, on ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Join(table, on...)) +} + +func (p planetSchematicsPinMapDo) LeftJoin(table schema.Tabler, on ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.LeftJoin(table, on...)) +} + +func (p planetSchematicsPinMapDo) RightJoin(table schema.Tabler, on ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.RightJoin(table, on...)) +} + +func (p planetSchematicsPinMapDo) Group(cols ...field.Expr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Group(cols...)) +} + +func (p planetSchematicsPinMapDo) Having(conds ...gen.Condition) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Having(conds...)) +} + +func (p planetSchematicsPinMapDo) Limit(limit int) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Limit(limit)) +} + +func (p planetSchematicsPinMapDo) Offset(offset int) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Offset(offset)) +} + +func (p planetSchematicsPinMapDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Scopes(funcs...)) +} + +func (p planetSchematicsPinMapDo) Unscoped() *planetSchematicsPinMapDo { + return p.withDO(p.DO.Unscoped()) +} + +func (p planetSchematicsPinMapDo) Create(values ...*models.PlanetSchematicsPinMap) error { + if len(values) == 0 { + return nil + } + return p.DO.Create(values) +} + +func (p planetSchematicsPinMapDo) CreateInBatches(values []*models.PlanetSchematicsPinMap, batchSize int) error { + return p.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 (p planetSchematicsPinMapDo) Save(values ...*models.PlanetSchematicsPinMap) error { + if len(values) == 0 { + return nil + } + return p.DO.Save(values) +} + +func (p planetSchematicsPinMapDo) First() (*models.PlanetSchematicsPinMap, error) { + if result, err := p.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsPinMap), nil + } +} + +func (p planetSchematicsPinMapDo) Take() (*models.PlanetSchematicsPinMap, error) { + if result, err := p.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsPinMap), nil + } +} + +func (p planetSchematicsPinMapDo) Last() (*models.PlanetSchematicsPinMap, error) { + if result, err := p.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsPinMap), nil + } +} + +func (p planetSchematicsPinMapDo) Find() ([]*models.PlanetSchematicsPinMap, error) { + result, err := p.DO.Find() + return result.([]*models.PlanetSchematicsPinMap), err +} + +func (p planetSchematicsPinMapDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.PlanetSchematicsPinMap, err error) { + buf := make([]*models.PlanetSchematicsPinMap, 0, batchSize) + err = p.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 (p planetSchematicsPinMapDo) FindInBatches(result *[]*models.PlanetSchematicsPinMap, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return p.DO.FindInBatches(result, batchSize, fc) +} + +func (p planetSchematicsPinMapDo) Attrs(attrs ...field.AssignExpr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Attrs(attrs...)) +} + +func (p planetSchematicsPinMapDo) Assign(attrs ...field.AssignExpr) *planetSchematicsPinMapDo { + return p.withDO(p.DO.Assign(attrs...)) +} + +func (p planetSchematicsPinMapDo) Joins(fields ...field.RelationField) *planetSchematicsPinMapDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Joins(_f)) + } + return &p +} + +func (p planetSchematicsPinMapDo) Preload(fields ...field.RelationField) *planetSchematicsPinMapDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Preload(_f)) + } + return &p +} + +func (p planetSchematicsPinMapDo) FirstOrInit() (*models.PlanetSchematicsPinMap, error) { + if result, err := p.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsPinMap), nil + } +} + +func (p planetSchematicsPinMapDo) FirstOrCreate() (*models.PlanetSchematicsPinMap, error) { + if result, err := p.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsPinMap), nil + } +} + +func (p planetSchematicsPinMapDo) FindByPage(offset int, limit int) (result []*models.PlanetSchematicsPinMap, count int64, err error) { + result, err = p.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 = p.Offset(-1).Limit(-1).Count() + return +} + +func (p planetSchematicsPinMapDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = p.Count() + if err != nil { + return + } + + err = p.Offset(offset).Limit(limit).Scan(result) + return +} + +func (p planetSchematicsPinMapDo) Scan(result interface{}) (err error) { + return p.DO.Scan(result) +} + +func (p planetSchematicsPinMapDo) Delete(models ...*models.PlanetSchematicsPinMap) (result gen.ResultInfo, err error) { + return p.DO.Delete(models) +} + +func (p *planetSchematicsPinMapDo) withDO(do gen.Dao) *planetSchematicsPinMapDo { + p.DO = *do.(*gen.DO) + return p +} diff --git a/models/planetschematicstypemap.gen.go b/models/planetschematicstypemap.gen.go new file mode 100644 index 0000000..20d8dda --- /dev/null +++ b/models/planetschematicstypemap.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newPlanetSchematicsTypeMap(db *gorm.DB, opts ...gen.DOOption) planetSchematicsTypeMap { + _planetSchematicsTypeMap := planetSchematicsTypeMap{} + + _planetSchematicsTypeMap.planetSchematicsTypeMapDo.UseDB(db, opts...) + _planetSchematicsTypeMap.planetSchematicsTypeMapDo.UseModel(&models.PlanetSchematicsTypeMap{}) + + tableName := _planetSchematicsTypeMap.planetSchematicsTypeMapDo.TableName() + _planetSchematicsTypeMap.ALL = field.NewAsterisk(tableName) + _planetSchematicsTypeMap.SchematicID = field.NewInt32(tableName, "schematicID") + _planetSchematicsTypeMap.TypeID = field.NewInt32(tableName, "typeID") + _planetSchematicsTypeMap.Quantity = field.NewInt32(tableName, "quantity") + _planetSchematicsTypeMap.IsInput = field.NewBool(tableName, "isInput") + + _planetSchematicsTypeMap.fillFieldMap() + + return _planetSchematicsTypeMap +} + +type planetSchematicsTypeMap struct { + planetSchematicsTypeMapDo planetSchematicsTypeMapDo + + ALL field.Asterisk + SchematicID field.Int32 + TypeID field.Int32 + Quantity field.Int32 + IsInput field.Bool + + fieldMap map[string]field.Expr +} + +func (p planetSchematicsTypeMap) Table(newTableName string) *planetSchematicsTypeMap { + p.planetSchematicsTypeMapDo.UseTable(newTableName) + return p.updateTableName(newTableName) +} + +func (p planetSchematicsTypeMap) As(alias string) *planetSchematicsTypeMap { + p.planetSchematicsTypeMapDo.DO = *(p.planetSchematicsTypeMapDo.As(alias).(*gen.DO)) + return p.updateTableName(alias) +} + +func (p *planetSchematicsTypeMap) updateTableName(table string) *planetSchematicsTypeMap { + p.ALL = field.NewAsterisk(table) + p.SchematicID = field.NewInt32(table, "schematicID") + p.TypeID = field.NewInt32(table, "typeID") + p.Quantity = field.NewInt32(table, "quantity") + p.IsInput = field.NewBool(table, "isInput") + + p.fillFieldMap() + + return p +} + +func (p *planetSchematicsTypeMap) WithContext(ctx context.Context) *planetSchematicsTypeMapDo { + return p.planetSchematicsTypeMapDo.WithContext(ctx) +} + +func (p planetSchematicsTypeMap) TableName() string { return p.planetSchematicsTypeMapDo.TableName() } + +func (p planetSchematicsTypeMap) Alias() string { return p.planetSchematicsTypeMapDo.Alias() } + +func (p planetSchematicsTypeMap) Columns(cols ...field.Expr) gen.Columns { + return p.planetSchematicsTypeMapDo.Columns(cols...) +} + +func (p *planetSchematicsTypeMap) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := p.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (p *planetSchematicsTypeMap) fillFieldMap() { + p.fieldMap = make(map[string]field.Expr, 4) + p.fieldMap["schematicID"] = p.SchematicID + p.fieldMap["typeID"] = p.TypeID + p.fieldMap["quantity"] = p.Quantity + p.fieldMap["isInput"] = p.IsInput +} + +func (p planetSchematicsTypeMap) clone(db *gorm.DB) planetSchematicsTypeMap { + p.planetSchematicsTypeMapDo.ReplaceConnPool(db.Statement.ConnPool) + return p +} + +func (p planetSchematicsTypeMap) replaceDB(db *gorm.DB) planetSchematicsTypeMap { + p.planetSchematicsTypeMapDo.ReplaceDB(db) + return p +} + +type planetSchematicsTypeMapDo struct{ gen.DO } + +func (p planetSchematicsTypeMapDo) Debug() *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Debug()) +} + +func (p planetSchematicsTypeMapDo) WithContext(ctx context.Context) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.WithContext(ctx)) +} + +func (p planetSchematicsTypeMapDo) ReadDB() *planetSchematicsTypeMapDo { + return p.Clauses(dbresolver.Read) +} + +func (p planetSchematicsTypeMapDo) WriteDB() *planetSchematicsTypeMapDo { + return p.Clauses(dbresolver.Write) +} + +func (p planetSchematicsTypeMapDo) Session(config *gorm.Session) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Session(config)) +} + +func (p planetSchematicsTypeMapDo) Clauses(conds ...clause.Expression) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Clauses(conds...)) +} + +func (p planetSchematicsTypeMapDo) Returning(value interface{}, columns ...string) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Returning(value, columns...)) +} + +func (p planetSchematicsTypeMapDo) Not(conds ...gen.Condition) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Not(conds...)) +} + +func (p planetSchematicsTypeMapDo) Or(conds ...gen.Condition) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Or(conds...)) +} + +func (p planetSchematicsTypeMapDo) Select(conds ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Select(conds...)) +} + +func (p planetSchematicsTypeMapDo) Where(conds ...gen.Condition) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Where(conds...)) +} + +func (p planetSchematicsTypeMapDo) Order(conds ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Order(conds...)) +} + +func (p planetSchematicsTypeMapDo) Distinct(cols ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Distinct(cols...)) +} + +func (p planetSchematicsTypeMapDo) Omit(cols ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Omit(cols...)) +} + +func (p planetSchematicsTypeMapDo) Join(table schema.Tabler, on ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Join(table, on...)) +} + +func (p planetSchematicsTypeMapDo) LeftJoin(table schema.Tabler, on ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.LeftJoin(table, on...)) +} + +func (p planetSchematicsTypeMapDo) RightJoin(table schema.Tabler, on ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.RightJoin(table, on...)) +} + +func (p planetSchematicsTypeMapDo) Group(cols ...field.Expr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Group(cols...)) +} + +func (p planetSchematicsTypeMapDo) Having(conds ...gen.Condition) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Having(conds...)) +} + +func (p planetSchematicsTypeMapDo) Limit(limit int) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Limit(limit)) +} + +func (p planetSchematicsTypeMapDo) Offset(offset int) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Offset(offset)) +} + +func (p planetSchematicsTypeMapDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Scopes(funcs...)) +} + +func (p planetSchematicsTypeMapDo) Unscoped() *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Unscoped()) +} + +func (p planetSchematicsTypeMapDo) Create(values ...*models.PlanetSchematicsTypeMap) error { + if len(values) == 0 { + return nil + } + return p.DO.Create(values) +} + +func (p planetSchematicsTypeMapDo) CreateInBatches(values []*models.PlanetSchematicsTypeMap, batchSize int) error { + return p.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 (p planetSchematicsTypeMapDo) Save(values ...*models.PlanetSchematicsTypeMap) error { + if len(values) == 0 { + return nil + } + return p.DO.Save(values) +} + +func (p planetSchematicsTypeMapDo) First() (*models.PlanetSchematicsTypeMap, error) { + if result, err := p.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsTypeMap), nil + } +} + +func (p planetSchematicsTypeMapDo) Take() (*models.PlanetSchematicsTypeMap, error) { + if result, err := p.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsTypeMap), nil + } +} + +func (p planetSchematicsTypeMapDo) Last() (*models.PlanetSchematicsTypeMap, error) { + if result, err := p.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsTypeMap), nil + } +} + +func (p planetSchematicsTypeMapDo) Find() ([]*models.PlanetSchematicsTypeMap, error) { + result, err := p.DO.Find() + return result.([]*models.PlanetSchematicsTypeMap), err +} + +func (p planetSchematicsTypeMapDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.PlanetSchematicsTypeMap, err error) { + buf := make([]*models.PlanetSchematicsTypeMap, 0, batchSize) + err = p.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 (p planetSchematicsTypeMapDo) FindInBatches(result *[]*models.PlanetSchematicsTypeMap, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return p.DO.FindInBatches(result, batchSize, fc) +} + +func (p planetSchematicsTypeMapDo) Attrs(attrs ...field.AssignExpr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Attrs(attrs...)) +} + +func (p planetSchematicsTypeMapDo) Assign(attrs ...field.AssignExpr) *planetSchematicsTypeMapDo { + return p.withDO(p.DO.Assign(attrs...)) +} + +func (p planetSchematicsTypeMapDo) Joins(fields ...field.RelationField) *planetSchematicsTypeMapDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Joins(_f)) + } + return &p +} + +func (p planetSchematicsTypeMapDo) Preload(fields ...field.RelationField) *planetSchematicsTypeMapDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Preload(_f)) + } + return &p +} + +func (p planetSchematicsTypeMapDo) FirstOrInit() (*models.PlanetSchematicsTypeMap, error) { + if result, err := p.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsTypeMap), nil + } +} + +func (p planetSchematicsTypeMapDo) FirstOrCreate() (*models.PlanetSchematicsTypeMap, error) { + if result, err := p.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.PlanetSchematicsTypeMap), nil + } +} + +func (p planetSchematicsTypeMapDo) FindByPage(offset int, limit int) (result []*models.PlanetSchematicsTypeMap, count int64, err error) { + result, err = p.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 = p.Offset(-1).Limit(-1).Count() + return +} + +func (p planetSchematicsTypeMapDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = p.Count() + if err != nil { + return + } + + err = p.Offset(offset).Limit(limit).Scan(result) + return +} + +func (p planetSchematicsTypeMapDo) Scan(result interface{}) (err error) { + return p.DO.Scan(result) +} + +func (p planetSchematicsTypeMapDo) Delete(models ...*models.PlanetSchematicsTypeMap) (result gen.ResultInfo, err error) { + return p.DO.Delete(models) +} + +func (p *planetSchematicsTypeMapDo) withDO(do gen.Dao) *planetSchematicsTypeMapDo { + p.DO = *do.(*gen.DO) + return p +} diff --git a/models/ramactivities.gen.go b/models/ramactivities.gen.go new file mode 100644 index 0000000..52a685f --- /dev/null +++ b/models/ramactivities.gen.go @@ -0,0 +1,345 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMActivity(db *gorm.DB, opts ...gen.DOOption) rAMActivity { + _rAMActivity := rAMActivity{} + + _rAMActivity.rAMActivityDo.UseDB(db, opts...) + _rAMActivity.rAMActivityDo.UseModel(&models.RAMActivity{}) + + tableName := _rAMActivity.rAMActivityDo.TableName() + _rAMActivity.ALL = field.NewAsterisk(tableName) + _rAMActivity.ActivityID = field.NewInt32(tableName, "activityID") + _rAMActivity.ActivityName = field.NewString(tableName, "activityName") + _rAMActivity.IconNo = field.NewString(tableName, "iconNo") + _rAMActivity.Description = field.NewString(tableName, "description") + _rAMActivity.Published = field.NewBool(tableName, "published") + + _rAMActivity.fillFieldMap() + + return _rAMActivity +} + +type rAMActivity struct { + rAMActivityDo rAMActivityDo + + ALL field.Asterisk + ActivityID field.Int32 + ActivityName field.String + IconNo field.String + Description field.String + Published field.Bool + + fieldMap map[string]field.Expr +} + +func (r rAMActivity) Table(newTableName string) *rAMActivity { + r.rAMActivityDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMActivity) As(alias string) *rAMActivity { + r.rAMActivityDo.DO = *(r.rAMActivityDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMActivity) updateTableName(table string) *rAMActivity { + r.ALL = field.NewAsterisk(table) + r.ActivityID = field.NewInt32(table, "activityID") + r.ActivityName = field.NewString(table, "activityName") + r.IconNo = field.NewString(table, "iconNo") + r.Description = field.NewString(table, "description") + r.Published = field.NewBool(table, "published") + + r.fillFieldMap() + + return r +} + +func (r *rAMActivity) WithContext(ctx context.Context) *rAMActivityDo { + return r.rAMActivityDo.WithContext(ctx) +} + +func (r rAMActivity) TableName() string { return r.rAMActivityDo.TableName() } + +func (r rAMActivity) Alias() string { return r.rAMActivityDo.Alias() } + +func (r rAMActivity) Columns(cols ...field.Expr) gen.Columns { return r.rAMActivityDo.Columns(cols...) } + +func (r *rAMActivity) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMActivity) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 5) + r.fieldMap["activityID"] = r.ActivityID + r.fieldMap["activityName"] = r.ActivityName + r.fieldMap["iconNo"] = r.IconNo + r.fieldMap["description"] = r.Description + r.fieldMap["published"] = r.Published +} + +func (r rAMActivity) clone(db *gorm.DB) rAMActivity { + r.rAMActivityDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMActivity) replaceDB(db *gorm.DB) rAMActivity { + r.rAMActivityDo.ReplaceDB(db) + return r +} + +type rAMActivityDo struct{ gen.DO } + +func (r rAMActivityDo) Debug() *rAMActivityDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMActivityDo) WithContext(ctx context.Context) *rAMActivityDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMActivityDo) ReadDB() *rAMActivityDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMActivityDo) WriteDB() *rAMActivityDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMActivityDo) Session(config *gorm.Session) *rAMActivityDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMActivityDo) Clauses(conds ...clause.Expression) *rAMActivityDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMActivityDo) Returning(value interface{}, columns ...string) *rAMActivityDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMActivityDo) Not(conds ...gen.Condition) *rAMActivityDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMActivityDo) Or(conds ...gen.Condition) *rAMActivityDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMActivityDo) Select(conds ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMActivityDo) Where(conds ...gen.Condition) *rAMActivityDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMActivityDo) Order(conds ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMActivityDo) Distinct(cols ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMActivityDo) Omit(cols ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMActivityDo) Join(table schema.Tabler, on ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMActivityDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMActivityDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMActivityDo) Group(cols ...field.Expr) *rAMActivityDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMActivityDo) Having(conds ...gen.Condition) *rAMActivityDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMActivityDo) Limit(limit int) *rAMActivityDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMActivityDo) Offset(offset int) *rAMActivityDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMActivityDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMActivityDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMActivityDo) Unscoped() *rAMActivityDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMActivityDo) Create(values ...*models.RAMActivity) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMActivityDo) CreateInBatches(values []*models.RAMActivity, batchSize int) error { + return r.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 (r rAMActivityDo) Save(values ...*models.RAMActivity) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMActivityDo) First() (*models.RAMActivity, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMActivity), nil + } +} + +func (r rAMActivityDo) Take() (*models.RAMActivity, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMActivity), nil + } +} + +func (r rAMActivityDo) Last() (*models.RAMActivity, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMActivity), nil + } +} + +func (r rAMActivityDo) Find() ([]*models.RAMActivity, error) { + result, err := r.DO.Find() + return result.([]*models.RAMActivity), err +} + +func (r rAMActivityDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMActivity, err error) { + buf := make([]*models.RAMActivity, 0, batchSize) + err = r.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 (r rAMActivityDo) FindInBatches(result *[]*models.RAMActivity, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMActivityDo) Attrs(attrs ...field.AssignExpr) *rAMActivityDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMActivityDo) Assign(attrs ...field.AssignExpr) *rAMActivityDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMActivityDo) Joins(fields ...field.RelationField) *rAMActivityDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMActivityDo) Preload(fields ...field.RelationField) *rAMActivityDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMActivityDo) FirstOrInit() (*models.RAMActivity, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMActivity), nil + } +} + +func (r rAMActivityDo) FirstOrCreate() (*models.RAMActivity, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMActivity), nil + } +} + +func (r rAMActivityDo) FindByPage(offset int, limit int) (result []*models.RAMActivity, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMActivityDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMActivityDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMActivityDo) Delete(models ...*models.RAMActivity) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMActivityDo) withDO(do gen.Dao) *rAMActivityDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/ramassemblylinestations.gen.go b/models/ramassemblylinestations.gen.go new file mode 100644 index 0000000..416ebb7 --- /dev/null +++ b/models/ramassemblylinestations.gen.go @@ -0,0 +1,355 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMAssemblyLineStation(db *gorm.DB, opts ...gen.DOOption) rAMAssemblyLineStation { + _rAMAssemblyLineStation := rAMAssemblyLineStation{} + + _rAMAssemblyLineStation.rAMAssemblyLineStationDo.UseDB(db, opts...) + _rAMAssemblyLineStation.rAMAssemblyLineStationDo.UseModel(&models.RAMAssemblyLineStation{}) + + tableName := _rAMAssemblyLineStation.rAMAssemblyLineStationDo.TableName() + _rAMAssemblyLineStation.ALL = field.NewAsterisk(tableName) + _rAMAssemblyLineStation.StationID = field.NewInt32(tableName, "stationID") + _rAMAssemblyLineStation.AssemblyLineTypeID = field.NewInt32(tableName, "assemblyLineTypeID") + _rAMAssemblyLineStation.Quantity = field.NewInt32(tableName, "quantity") + _rAMAssemblyLineStation.StationTypeID = field.NewInt32(tableName, "stationTypeID") + _rAMAssemblyLineStation.OwnerID = field.NewInt32(tableName, "ownerID") + _rAMAssemblyLineStation.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _rAMAssemblyLineStation.RegionID = field.NewInt32(tableName, "regionID") + + _rAMAssemblyLineStation.fillFieldMap() + + return _rAMAssemblyLineStation +} + +type rAMAssemblyLineStation struct { + rAMAssemblyLineStationDo rAMAssemblyLineStationDo + + ALL field.Asterisk + StationID field.Int32 + AssemblyLineTypeID field.Int32 + Quantity field.Int32 + StationTypeID field.Int32 + OwnerID field.Int32 + SolarSystemID field.Int32 + RegionID field.Int32 + + fieldMap map[string]field.Expr +} + +func (r rAMAssemblyLineStation) Table(newTableName string) *rAMAssemblyLineStation { + r.rAMAssemblyLineStationDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMAssemblyLineStation) As(alias string) *rAMAssemblyLineStation { + r.rAMAssemblyLineStationDo.DO = *(r.rAMAssemblyLineStationDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMAssemblyLineStation) updateTableName(table string) *rAMAssemblyLineStation { + r.ALL = field.NewAsterisk(table) + r.StationID = field.NewInt32(table, "stationID") + r.AssemblyLineTypeID = field.NewInt32(table, "assemblyLineTypeID") + r.Quantity = field.NewInt32(table, "quantity") + r.StationTypeID = field.NewInt32(table, "stationTypeID") + r.OwnerID = field.NewInt32(table, "ownerID") + r.SolarSystemID = field.NewInt32(table, "solarSystemID") + r.RegionID = field.NewInt32(table, "regionID") + + r.fillFieldMap() + + return r +} + +func (r *rAMAssemblyLineStation) WithContext(ctx context.Context) *rAMAssemblyLineStationDo { + return r.rAMAssemblyLineStationDo.WithContext(ctx) +} + +func (r rAMAssemblyLineStation) TableName() string { return r.rAMAssemblyLineStationDo.TableName() } + +func (r rAMAssemblyLineStation) Alias() string { return r.rAMAssemblyLineStationDo.Alias() } + +func (r rAMAssemblyLineStation) Columns(cols ...field.Expr) gen.Columns { + return r.rAMAssemblyLineStationDo.Columns(cols...) +} + +func (r *rAMAssemblyLineStation) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMAssemblyLineStation) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 7) + r.fieldMap["stationID"] = r.StationID + r.fieldMap["assemblyLineTypeID"] = r.AssemblyLineTypeID + r.fieldMap["quantity"] = r.Quantity + r.fieldMap["stationTypeID"] = r.StationTypeID + r.fieldMap["ownerID"] = r.OwnerID + r.fieldMap["solarSystemID"] = r.SolarSystemID + r.fieldMap["regionID"] = r.RegionID +} + +func (r rAMAssemblyLineStation) clone(db *gorm.DB) rAMAssemblyLineStation { + r.rAMAssemblyLineStationDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMAssemblyLineStation) replaceDB(db *gorm.DB) rAMAssemblyLineStation { + r.rAMAssemblyLineStationDo.ReplaceDB(db) + return r +} + +type rAMAssemblyLineStationDo struct{ gen.DO } + +func (r rAMAssemblyLineStationDo) Debug() *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMAssemblyLineStationDo) WithContext(ctx context.Context) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMAssemblyLineStationDo) ReadDB() *rAMAssemblyLineStationDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMAssemblyLineStationDo) WriteDB() *rAMAssemblyLineStationDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMAssemblyLineStationDo) Session(config *gorm.Session) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMAssemblyLineStationDo) Clauses(conds ...clause.Expression) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMAssemblyLineStationDo) Returning(value interface{}, columns ...string) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMAssemblyLineStationDo) Not(conds ...gen.Condition) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMAssemblyLineStationDo) Or(conds ...gen.Condition) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMAssemblyLineStationDo) Select(conds ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMAssemblyLineStationDo) Where(conds ...gen.Condition) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMAssemblyLineStationDo) Order(conds ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMAssemblyLineStationDo) Distinct(cols ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMAssemblyLineStationDo) Omit(cols ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMAssemblyLineStationDo) Join(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMAssemblyLineStationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMAssemblyLineStationDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMAssemblyLineStationDo) Group(cols ...field.Expr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMAssemblyLineStationDo) Having(conds ...gen.Condition) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMAssemblyLineStationDo) Limit(limit int) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMAssemblyLineStationDo) Offset(offset int) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMAssemblyLineStationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMAssemblyLineStationDo) Unscoped() *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMAssemblyLineStationDo) Create(values ...*models.RAMAssemblyLineStation) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMAssemblyLineStationDo) CreateInBatches(values []*models.RAMAssemblyLineStation, batchSize int) error { + return r.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 (r rAMAssemblyLineStationDo) Save(values ...*models.RAMAssemblyLineStation) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMAssemblyLineStationDo) First() (*models.RAMAssemblyLineStation, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineStation), nil + } +} + +func (r rAMAssemblyLineStationDo) Take() (*models.RAMAssemblyLineStation, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineStation), nil + } +} + +func (r rAMAssemblyLineStationDo) Last() (*models.RAMAssemblyLineStation, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineStation), nil + } +} + +func (r rAMAssemblyLineStationDo) Find() ([]*models.RAMAssemblyLineStation, error) { + result, err := r.DO.Find() + return result.([]*models.RAMAssemblyLineStation), err +} + +func (r rAMAssemblyLineStationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMAssemblyLineStation, err error) { + buf := make([]*models.RAMAssemblyLineStation, 0, batchSize) + err = r.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 (r rAMAssemblyLineStationDo) FindInBatches(result *[]*models.RAMAssemblyLineStation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMAssemblyLineStationDo) Attrs(attrs ...field.AssignExpr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMAssemblyLineStationDo) Assign(attrs ...field.AssignExpr) *rAMAssemblyLineStationDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMAssemblyLineStationDo) Joins(fields ...field.RelationField) *rAMAssemblyLineStationDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMAssemblyLineStationDo) Preload(fields ...field.RelationField) *rAMAssemblyLineStationDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMAssemblyLineStationDo) FirstOrInit() (*models.RAMAssemblyLineStation, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineStation), nil + } +} + +func (r rAMAssemblyLineStationDo) FirstOrCreate() (*models.RAMAssemblyLineStation, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineStation), nil + } +} + +func (r rAMAssemblyLineStationDo) FindByPage(offset int, limit int) (result []*models.RAMAssemblyLineStation, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMAssemblyLineStationDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMAssemblyLineStationDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMAssemblyLineStationDo) Delete(models ...*models.RAMAssemblyLineStation) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMAssemblyLineStationDo) withDO(do gen.Dao) *rAMAssemblyLineStationDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/ramassemblylinetypedetailpercategory.gen.go b/models/ramassemblylinetypedetailpercategory.gen.go new file mode 100644 index 0000000..73191f4 --- /dev/null +++ b/models/ramassemblylinetypedetailpercategory.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMAssemblyLineTypeDetailPerCategory(db *gorm.DB, opts ...gen.DOOption) rAMAssemblyLineTypeDetailPerCategory { + _rAMAssemblyLineTypeDetailPerCategory := rAMAssemblyLineTypeDetailPerCategory{} + + _rAMAssemblyLineTypeDetailPerCategory.rAMAssemblyLineTypeDetailPerCategoryDo.UseDB(db, opts...) + _rAMAssemblyLineTypeDetailPerCategory.rAMAssemblyLineTypeDetailPerCategoryDo.UseModel(&models.RAMAssemblyLineTypeDetailPerCategory{}) + + tableName := _rAMAssemblyLineTypeDetailPerCategory.rAMAssemblyLineTypeDetailPerCategoryDo.TableName() + _rAMAssemblyLineTypeDetailPerCategory.ALL = field.NewAsterisk(tableName) + _rAMAssemblyLineTypeDetailPerCategory.AssemblyLineTypeID = field.NewInt32(tableName, "assemblyLineTypeID") + _rAMAssemblyLineTypeDetailPerCategory.CategoryID = field.NewInt32(tableName, "categoryID") + _rAMAssemblyLineTypeDetailPerCategory.TimeMultiplier = field.NewFloat64(tableName, "timeMultiplier") + _rAMAssemblyLineTypeDetailPerCategory.MaterialMultiplier = field.NewFloat64(tableName, "materialMultiplier") + _rAMAssemblyLineTypeDetailPerCategory.CostMultiplier = field.NewFloat64(tableName, "costMultiplier") + + _rAMAssemblyLineTypeDetailPerCategory.fillFieldMap() + + return _rAMAssemblyLineTypeDetailPerCategory +} + +type rAMAssemblyLineTypeDetailPerCategory struct { + rAMAssemblyLineTypeDetailPerCategoryDo rAMAssemblyLineTypeDetailPerCategoryDo + + ALL field.Asterisk + AssemblyLineTypeID field.Int32 + CategoryID field.Int32 + TimeMultiplier field.Float64 + MaterialMultiplier field.Float64 + CostMultiplier field.Float64 + + fieldMap map[string]field.Expr +} + +func (r rAMAssemblyLineTypeDetailPerCategory) Table(newTableName string) *rAMAssemblyLineTypeDetailPerCategory { + r.rAMAssemblyLineTypeDetailPerCategoryDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMAssemblyLineTypeDetailPerCategory) As(alias string) *rAMAssemblyLineTypeDetailPerCategory { + r.rAMAssemblyLineTypeDetailPerCategoryDo.DO = *(r.rAMAssemblyLineTypeDetailPerCategoryDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMAssemblyLineTypeDetailPerCategory) updateTableName(table string) *rAMAssemblyLineTypeDetailPerCategory { + r.ALL = field.NewAsterisk(table) + r.AssemblyLineTypeID = field.NewInt32(table, "assemblyLineTypeID") + r.CategoryID = field.NewInt32(table, "categoryID") + r.TimeMultiplier = field.NewFloat64(table, "timeMultiplier") + r.MaterialMultiplier = field.NewFloat64(table, "materialMultiplier") + r.CostMultiplier = field.NewFloat64(table, "costMultiplier") + + r.fillFieldMap() + + return r +} + +func (r *rAMAssemblyLineTypeDetailPerCategory) WithContext(ctx context.Context) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.rAMAssemblyLineTypeDetailPerCategoryDo.WithContext(ctx) +} + +func (r rAMAssemblyLineTypeDetailPerCategory) TableName() string { + return r.rAMAssemblyLineTypeDetailPerCategoryDo.TableName() +} + +func (r rAMAssemblyLineTypeDetailPerCategory) Alias() string { + return r.rAMAssemblyLineTypeDetailPerCategoryDo.Alias() +} + +func (r rAMAssemblyLineTypeDetailPerCategory) Columns(cols ...field.Expr) gen.Columns { + return r.rAMAssemblyLineTypeDetailPerCategoryDo.Columns(cols...) +} + +func (r *rAMAssemblyLineTypeDetailPerCategory) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMAssemblyLineTypeDetailPerCategory) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 5) + r.fieldMap["assemblyLineTypeID"] = r.AssemblyLineTypeID + r.fieldMap["categoryID"] = r.CategoryID + r.fieldMap["timeMultiplier"] = r.TimeMultiplier + r.fieldMap["materialMultiplier"] = r.MaterialMultiplier + r.fieldMap["costMultiplier"] = r.CostMultiplier +} + +func (r rAMAssemblyLineTypeDetailPerCategory) clone(db *gorm.DB) rAMAssemblyLineTypeDetailPerCategory { + r.rAMAssemblyLineTypeDetailPerCategoryDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMAssemblyLineTypeDetailPerCategory) replaceDB(db *gorm.DB) rAMAssemblyLineTypeDetailPerCategory { + r.rAMAssemblyLineTypeDetailPerCategoryDo.ReplaceDB(db) + return r +} + +type rAMAssemblyLineTypeDetailPerCategoryDo struct{ gen.DO } + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Debug() *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) WithContext(ctx context.Context) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) ReadDB() *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) WriteDB() *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Session(config *gorm.Session) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Clauses(conds ...clause.Expression) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Returning(value interface{}, columns ...string) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Not(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Or(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Select(conds ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Where(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Order(conds ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Distinct(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Omit(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Join(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Group(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Having(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Limit(limit int) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Offset(offset int) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Unscoped() *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Create(values ...*models.RAMAssemblyLineTypeDetailPerCategory) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) CreateInBatches(values []*models.RAMAssemblyLineTypeDetailPerCategory, batchSize int) error { + return r.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 (r rAMAssemblyLineTypeDetailPerCategoryDo) Save(values ...*models.RAMAssemblyLineTypeDetailPerCategory) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) First() (*models.RAMAssemblyLineTypeDetailPerCategory, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerCategory), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Take() (*models.RAMAssemblyLineTypeDetailPerCategory, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerCategory), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Last() (*models.RAMAssemblyLineTypeDetailPerCategory, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerCategory), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Find() ([]*models.RAMAssemblyLineTypeDetailPerCategory, error) { + result, err := r.DO.Find() + return result.([]*models.RAMAssemblyLineTypeDetailPerCategory), err +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMAssemblyLineTypeDetailPerCategory, err error) { + buf := make([]*models.RAMAssemblyLineTypeDetailPerCategory, 0, batchSize) + err = r.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 (r rAMAssemblyLineTypeDetailPerCategoryDo) FindInBatches(result *[]*models.RAMAssemblyLineTypeDetailPerCategory, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Attrs(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Assign(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDetailPerCategoryDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Joins(fields ...field.RelationField) *rAMAssemblyLineTypeDetailPerCategoryDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Preload(fields ...field.RelationField) *rAMAssemblyLineTypeDetailPerCategoryDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) FirstOrInit() (*models.RAMAssemblyLineTypeDetailPerCategory, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerCategory), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) FirstOrCreate() (*models.RAMAssemblyLineTypeDetailPerCategory, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerCategory), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) FindByPage(offset int, limit int) (result []*models.RAMAssemblyLineTypeDetailPerCategory, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMAssemblyLineTypeDetailPerCategoryDo) Delete(models ...*models.RAMAssemblyLineTypeDetailPerCategory) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMAssemblyLineTypeDetailPerCategoryDo) withDO(do gen.Dao) *rAMAssemblyLineTypeDetailPerCategoryDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/ramassemblylinetypedetailpergroup.gen.go b/models/ramassemblylinetypedetailpergroup.gen.go new file mode 100644 index 0000000..02b0dde --- /dev/null +++ b/models/ramassemblylinetypedetailpergroup.gen.go @@ -0,0 +1,351 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMAssemblyLineTypeDetailPerGroup(db *gorm.DB, opts ...gen.DOOption) rAMAssemblyLineTypeDetailPerGroup { + _rAMAssemblyLineTypeDetailPerGroup := rAMAssemblyLineTypeDetailPerGroup{} + + _rAMAssemblyLineTypeDetailPerGroup.rAMAssemblyLineTypeDetailPerGroupDo.UseDB(db, opts...) + _rAMAssemblyLineTypeDetailPerGroup.rAMAssemblyLineTypeDetailPerGroupDo.UseModel(&models.RAMAssemblyLineTypeDetailPerGroup{}) + + tableName := _rAMAssemblyLineTypeDetailPerGroup.rAMAssemblyLineTypeDetailPerGroupDo.TableName() + _rAMAssemblyLineTypeDetailPerGroup.ALL = field.NewAsterisk(tableName) + _rAMAssemblyLineTypeDetailPerGroup.AssemblyLineTypeID = field.NewInt32(tableName, "assemblyLineTypeID") + _rAMAssemblyLineTypeDetailPerGroup.GroupID = field.NewInt32(tableName, "groupID") + _rAMAssemblyLineTypeDetailPerGroup.TimeMultiplier = field.NewFloat64(tableName, "timeMultiplier") + _rAMAssemblyLineTypeDetailPerGroup.MaterialMultiplier = field.NewFloat64(tableName, "materialMultiplier") + _rAMAssemblyLineTypeDetailPerGroup.CostMultiplier = field.NewFloat64(tableName, "costMultiplier") + + _rAMAssemblyLineTypeDetailPerGroup.fillFieldMap() + + return _rAMAssemblyLineTypeDetailPerGroup +} + +type rAMAssemblyLineTypeDetailPerGroup struct { + rAMAssemblyLineTypeDetailPerGroupDo rAMAssemblyLineTypeDetailPerGroupDo + + ALL field.Asterisk + AssemblyLineTypeID field.Int32 + GroupID field.Int32 + TimeMultiplier field.Float64 + MaterialMultiplier field.Float64 + CostMultiplier field.Float64 + + fieldMap map[string]field.Expr +} + +func (r rAMAssemblyLineTypeDetailPerGroup) Table(newTableName string) *rAMAssemblyLineTypeDetailPerGroup { + r.rAMAssemblyLineTypeDetailPerGroupDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMAssemblyLineTypeDetailPerGroup) As(alias string) *rAMAssemblyLineTypeDetailPerGroup { + r.rAMAssemblyLineTypeDetailPerGroupDo.DO = *(r.rAMAssemblyLineTypeDetailPerGroupDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMAssemblyLineTypeDetailPerGroup) updateTableName(table string) *rAMAssemblyLineTypeDetailPerGroup { + r.ALL = field.NewAsterisk(table) + r.AssemblyLineTypeID = field.NewInt32(table, "assemblyLineTypeID") + r.GroupID = field.NewInt32(table, "groupID") + r.TimeMultiplier = field.NewFloat64(table, "timeMultiplier") + r.MaterialMultiplier = field.NewFloat64(table, "materialMultiplier") + r.CostMultiplier = field.NewFloat64(table, "costMultiplier") + + r.fillFieldMap() + + return r +} + +func (r *rAMAssemblyLineTypeDetailPerGroup) WithContext(ctx context.Context) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.rAMAssemblyLineTypeDetailPerGroupDo.WithContext(ctx) +} + +func (r rAMAssemblyLineTypeDetailPerGroup) TableName() string { + return r.rAMAssemblyLineTypeDetailPerGroupDo.TableName() +} + +func (r rAMAssemblyLineTypeDetailPerGroup) Alias() string { + return r.rAMAssemblyLineTypeDetailPerGroupDo.Alias() +} + +func (r rAMAssemblyLineTypeDetailPerGroup) Columns(cols ...field.Expr) gen.Columns { + return r.rAMAssemblyLineTypeDetailPerGroupDo.Columns(cols...) +} + +func (r *rAMAssemblyLineTypeDetailPerGroup) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMAssemblyLineTypeDetailPerGroup) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 5) + r.fieldMap["assemblyLineTypeID"] = r.AssemblyLineTypeID + r.fieldMap["groupID"] = r.GroupID + r.fieldMap["timeMultiplier"] = r.TimeMultiplier + r.fieldMap["materialMultiplier"] = r.MaterialMultiplier + r.fieldMap["costMultiplier"] = r.CostMultiplier +} + +func (r rAMAssemblyLineTypeDetailPerGroup) clone(db *gorm.DB) rAMAssemblyLineTypeDetailPerGroup { + r.rAMAssemblyLineTypeDetailPerGroupDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMAssemblyLineTypeDetailPerGroup) replaceDB(db *gorm.DB) rAMAssemblyLineTypeDetailPerGroup { + r.rAMAssemblyLineTypeDetailPerGroupDo.ReplaceDB(db) + return r +} + +type rAMAssemblyLineTypeDetailPerGroupDo struct{ gen.DO } + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Debug() *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) WithContext(ctx context.Context) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) ReadDB() *rAMAssemblyLineTypeDetailPerGroupDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) WriteDB() *rAMAssemblyLineTypeDetailPerGroupDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Session(config *gorm.Session) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Clauses(conds ...clause.Expression) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Returning(value interface{}, columns ...string) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Not(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Or(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Select(conds ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Where(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Order(conds ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Distinct(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Omit(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Join(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Group(cols ...field.Expr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Having(conds ...gen.Condition) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Limit(limit int) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Offset(offset int) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Unscoped() *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Create(values ...*models.RAMAssemblyLineTypeDetailPerGroup) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) CreateInBatches(values []*models.RAMAssemblyLineTypeDetailPerGroup, batchSize int) error { + return r.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 (r rAMAssemblyLineTypeDetailPerGroupDo) Save(values ...*models.RAMAssemblyLineTypeDetailPerGroup) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) First() (*models.RAMAssemblyLineTypeDetailPerGroup, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerGroup), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Take() (*models.RAMAssemblyLineTypeDetailPerGroup, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerGroup), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Last() (*models.RAMAssemblyLineTypeDetailPerGroup, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerGroup), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Find() ([]*models.RAMAssemblyLineTypeDetailPerGroup, error) { + result, err := r.DO.Find() + return result.([]*models.RAMAssemblyLineTypeDetailPerGroup), err +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMAssemblyLineTypeDetailPerGroup, err error) { + buf := make([]*models.RAMAssemblyLineTypeDetailPerGroup, 0, batchSize) + err = r.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 (r rAMAssemblyLineTypeDetailPerGroupDo) FindInBatches(result *[]*models.RAMAssemblyLineTypeDetailPerGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Attrs(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Assign(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDetailPerGroupDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Joins(fields ...field.RelationField) *rAMAssemblyLineTypeDetailPerGroupDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Preload(fields ...field.RelationField) *rAMAssemblyLineTypeDetailPerGroupDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) FirstOrInit() (*models.RAMAssemblyLineTypeDetailPerGroup, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerGroup), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) FirstOrCreate() (*models.RAMAssemblyLineTypeDetailPerGroup, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineTypeDetailPerGroup), nil + } +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) FindByPage(offset int, limit int) (result []*models.RAMAssemblyLineTypeDetailPerGroup, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMAssemblyLineTypeDetailPerGroupDo) Delete(models ...*models.RAMAssemblyLineTypeDetailPerGroup) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMAssemblyLineTypeDetailPerGroupDo) withDO(do gen.Dao) *rAMAssemblyLineTypeDetailPerGroupDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/ramassemblylinetypes.gen.go b/models/ramassemblylinetypes.gen.go new file mode 100644 index 0000000..93cfc74 --- /dev/null +++ b/models/ramassemblylinetypes.gen.go @@ -0,0 +1,363 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMAssemblyLineType(db *gorm.DB, opts ...gen.DOOption) rAMAssemblyLineType { + _rAMAssemblyLineType := rAMAssemblyLineType{} + + _rAMAssemblyLineType.rAMAssemblyLineTypeDo.UseDB(db, opts...) + _rAMAssemblyLineType.rAMAssemblyLineTypeDo.UseModel(&models.RAMAssemblyLineType{}) + + tableName := _rAMAssemblyLineType.rAMAssemblyLineTypeDo.TableName() + _rAMAssemblyLineType.ALL = field.NewAsterisk(tableName) + _rAMAssemblyLineType.AssemblyLineTypeID = field.NewInt32(tableName, "assemblyLineTypeID") + _rAMAssemblyLineType.AssemblyLineTypeName = field.NewString(tableName, "assemblyLineTypeName") + _rAMAssemblyLineType.Description = field.NewString(tableName, "description") + _rAMAssemblyLineType.BaseTimeMultiplier = field.NewFloat64(tableName, "baseTimeMultiplier") + _rAMAssemblyLineType.BaseMaterialMultiplier = field.NewFloat64(tableName, "baseMaterialMultiplier") + _rAMAssemblyLineType.BaseCostMultiplier = field.NewFloat64(tableName, "baseCostMultiplier") + _rAMAssemblyLineType.Volume = field.NewFloat64(tableName, "volume") + _rAMAssemblyLineType.ActivityID = field.NewInt32(tableName, "activityID") + _rAMAssemblyLineType.MinCostPerHour = field.NewFloat64(tableName, "minCostPerHour") + + _rAMAssemblyLineType.fillFieldMap() + + return _rAMAssemblyLineType +} + +type rAMAssemblyLineType struct { + rAMAssemblyLineTypeDo rAMAssemblyLineTypeDo + + ALL field.Asterisk + AssemblyLineTypeID field.Int32 + AssemblyLineTypeName field.String + Description field.String + BaseTimeMultiplier field.Float64 + BaseMaterialMultiplier field.Float64 + BaseCostMultiplier field.Float64 + Volume field.Float64 + ActivityID field.Int32 + MinCostPerHour field.Float64 + + fieldMap map[string]field.Expr +} + +func (r rAMAssemblyLineType) Table(newTableName string) *rAMAssemblyLineType { + r.rAMAssemblyLineTypeDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMAssemblyLineType) As(alias string) *rAMAssemblyLineType { + r.rAMAssemblyLineTypeDo.DO = *(r.rAMAssemblyLineTypeDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMAssemblyLineType) updateTableName(table string) *rAMAssemblyLineType { + r.ALL = field.NewAsterisk(table) + r.AssemblyLineTypeID = field.NewInt32(table, "assemblyLineTypeID") + r.AssemblyLineTypeName = field.NewString(table, "assemblyLineTypeName") + r.Description = field.NewString(table, "description") + r.BaseTimeMultiplier = field.NewFloat64(table, "baseTimeMultiplier") + r.BaseMaterialMultiplier = field.NewFloat64(table, "baseMaterialMultiplier") + r.BaseCostMultiplier = field.NewFloat64(table, "baseCostMultiplier") + r.Volume = field.NewFloat64(table, "volume") + r.ActivityID = field.NewInt32(table, "activityID") + r.MinCostPerHour = field.NewFloat64(table, "minCostPerHour") + + r.fillFieldMap() + + return r +} + +func (r *rAMAssemblyLineType) WithContext(ctx context.Context) *rAMAssemblyLineTypeDo { + return r.rAMAssemblyLineTypeDo.WithContext(ctx) +} + +func (r rAMAssemblyLineType) TableName() string { return r.rAMAssemblyLineTypeDo.TableName() } + +func (r rAMAssemblyLineType) Alias() string { return r.rAMAssemblyLineTypeDo.Alias() } + +func (r rAMAssemblyLineType) Columns(cols ...field.Expr) gen.Columns { + return r.rAMAssemblyLineTypeDo.Columns(cols...) +} + +func (r *rAMAssemblyLineType) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMAssemblyLineType) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 9) + r.fieldMap["assemblyLineTypeID"] = r.AssemblyLineTypeID + r.fieldMap["assemblyLineTypeName"] = r.AssemblyLineTypeName + r.fieldMap["description"] = r.Description + r.fieldMap["baseTimeMultiplier"] = r.BaseTimeMultiplier + r.fieldMap["baseMaterialMultiplier"] = r.BaseMaterialMultiplier + r.fieldMap["baseCostMultiplier"] = r.BaseCostMultiplier + r.fieldMap["volume"] = r.Volume + r.fieldMap["activityID"] = r.ActivityID + r.fieldMap["minCostPerHour"] = r.MinCostPerHour +} + +func (r rAMAssemblyLineType) clone(db *gorm.DB) rAMAssemblyLineType { + r.rAMAssemblyLineTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMAssemblyLineType) replaceDB(db *gorm.DB) rAMAssemblyLineType { + r.rAMAssemblyLineTypeDo.ReplaceDB(db) + return r +} + +type rAMAssemblyLineTypeDo struct{ gen.DO } + +func (r rAMAssemblyLineTypeDo) Debug() *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMAssemblyLineTypeDo) WithContext(ctx context.Context) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMAssemblyLineTypeDo) ReadDB() *rAMAssemblyLineTypeDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMAssemblyLineTypeDo) WriteDB() *rAMAssemblyLineTypeDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMAssemblyLineTypeDo) Session(config *gorm.Session) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMAssemblyLineTypeDo) Clauses(conds ...clause.Expression) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Returning(value interface{}, columns ...string) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMAssemblyLineTypeDo) Not(conds ...gen.Condition) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Or(conds ...gen.Condition) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Select(conds ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Where(conds ...gen.Condition) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Order(conds ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Distinct(cols ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMAssemblyLineTypeDo) Omit(cols ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMAssemblyLineTypeDo) Join(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMAssemblyLineTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMAssemblyLineTypeDo) Group(cols ...field.Expr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMAssemblyLineTypeDo) Having(conds ...gen.Condition) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMAssemblyLineTypeDo) Limit(limit int) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMAssemblyLineTypeDo) Offset(offset int) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMAssemblyLineTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMAssemblyLineTypeDo) Unscoped() *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMAssemblyLineTypeDo) Create(values ...*models.RAMAssemblyLineType) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMAssemblyLineTypeDo) CreateInBatches(values []*models.RAMAssemblyLineType, batchSize int) error { + return r.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 (r rAMAssemblyLineTypeDo) Save(values ...*models.RAMAssemblyLineType) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMAssemblyLineTypeDo) First() (*models.RAMAssemblyLineType, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineType), nil + } +} + +func (r rAMAssemblyLineTypeDo) Take() (*models.RAMAssemblyLineType, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineType), nil + } +} + +func (r rAMAssemblyLineTypeDo) Last() (*models.RAMAssemblyLineType, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineType), nil + } +} + +func (r rAMAssemblyLineTypeDo) Find() ([]*models.RAMAssemblyLineType, error) { + result, err := r.DO.Find() + return result.([]*models.RAMAssemblyLineType), err +} + +func (r rAMAssemblyLineTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMAssemblyLineType, err error) { + buf := make([]*models.RAMAssemblyLineType, 0, batchSize) + err = r.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 (r rAMAssemblyLineTypeDo) FindInBatches(result *[]*models.RAMAssemblyLineType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMAssemblyLineTypeDo) Attrs(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMAssemblyLineTypeDo) Assign(attrs ...field.AssignExpr) *rAMAssemblyLineTypeDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMAssemblyLineTypeDo) Joins(fields ...field.RelationField) *rAMAssemblyLineTypeDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDo) Preload(fields ...field.RelationField) *rAMAssemblyLineTypeDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMAssemblyLineTypeDo) FirstOrInit() (*models.RAMAssemblyLineType, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineType), nil + } +} + +func (r rAMAssemblyLineTypeDo) FirstOrCreate() (*models.RAMAssemblyLineType, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMAssemblyLineType), nil + } +} + +func (r rAMAssemblyLineTypeDo) FindByPage(offset int, limit int) (result []*models.RAMAssemblyLineType, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMAssemblyLineTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMAssemblyLineTypeDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMAssemblyLineTypeDo) Delete(models ...*models.RAMAssemblyLineType) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMAssemblyLineTypeDo) withDO(do gen.Dao) *rAMAssemblyLineTypeDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/raminstallationtypecontents.gen.go b/models/raminstallationtypecontents.gen.go new file mode 100644 index 0000000..9856307 --- /dev/null +++ b/models/raminstallationtypecontents.gen.go @@ -0,0 +1,341 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newRAMInstallationTypeContent(db *gorm.DB, opts ...gen.DOOption) rAMInstallationTypeContent { + _rAMInstallationTypeContent := rAMInstallationTypeContent{} + + _rAMInstallationTypeContent.rAMInstallationTypeContentDo.UseDB(db, opts...) + _rAMInstallationTypeContent.rAMInstallationTypeContentDo.UseModel(&models.RAMInstallationTypeContent{}) + + tableName := _rAMInstallationTypeContent.rAMInstallationTypeContentDo.TableName() + _rAMInstallationTypeContent.ALL = field.NewAsterisk(tableName) + _rAMInstallationTypeContent.InstallationTypeID = field.NewInt32(tableName, "installationTypeID") + _rAMInstallationTypeContent.AssemblyLineTypeID = field.NewInt32(tableName, "assemblyLineTypeID") + _rAMInstallationTypeContent.Quantity = field.NewInt32(tableName, "quantity") + + _rAMInstallationTypeContent.fillFieldMap() + + return _rAMInstallationTypeContent +} + +type rAMInstallationTypeContent struct { + rAMInstallationTypeContentDo rAMInstallationTypeContentDo + + ALL field.Asterisk + InstallationTypeID field.Int32 + AssemblyLineTypeID field.Int32 + Quantity field.Int32 + + fieldMap map[string]field.Expr +} + +func (r rAMInstallationTypeContent) Table(newTableName string) *rAMInstallationTypeContent { + r.rAMInstallationTypeContentDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r rAMInstallationTypeContent) As(alias string) *rAMInstallationTypeContent { + r.rAMInstallationTypeContentDo.DO = *(r.rAMInstallationTypeContentDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *rAMInstallationTypeContent) updateTableName(table string) *rAMInstallationTypeContent { + r.ALL = field.NewAsterisk(table) + r.InstallationTypeID = field.NewInt32(table, "installationTypeID") + r.AssemblyLineTypeID = field.NewInt32(table, "assemblyLineTypeID") + r.Quantity = field.NewInt32(table, "quantity") + + r.fillFieldMap() + + return r +} + +func (r *rAMInstallationTypeContent) WithContext(ctx context.Context) *rAMInstallationTypeContentDo { + return r.rAMInstallationTypeContentDo.WithContext(ctx) +} + +func (r rAMInstallationTypeContent) TableName() string { + return r.rAMInstallationTypeContentDo.TableName() +} + +func (r rAMInstallationTypeContent) Alias() string { return r.rAMInstallationTypeContentDo.Alias() } + +func (r rAMInstallationTypeContent) Columns(cols ...field.Expr) gen.Columns { + return r.rAMInstallationTypeContentDo.Columns(cols...) +} + +func (r *rAMInstallationTypeContent) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *rAMInstallationTypeContent) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 3) + r.fieldMap["installationTypeID"] = r.InstallationTypeID + r.fieldMap["assemblyLineTypeID"] = r.AssemblyLineTypeID + r.fieldMap["quantity"] = r.Quantity +} + +func (r rAMInstallationTypeContent) clone(db *gorm.DB) rAMInstallationTypeContent { + r.rAMInstallationTypeContentDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r rAMInstallationTypeContent) replaceDB(db *gorm.DB) rAMInstallationTypeContent { + r.rAMInstallationTypeContentDo.ReplaceDB(db) + return r +} + +type rAMInstallationTypeContentDo struct{ gen.DO } + +func (r rAMInstallationTypeContentDo) Debug() *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Debug()) +} + +func (r rAMInstallationTypeContentDo) WithContext(ctx context.Context) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r rAMInstallationTypeContentDo) ReadDB() *rAMInstallationTypeContentDo { + return r.Clauses(dbresolver.Read) +} + +func (r rAMInstallationTypeContentDo) WriteDB() *rAMInstallationTypeContentDo { + return r.Clauses(dbresolver.Write) +} + +func (r rAMInstallationTypeContentDo) Session(config *gorm.Session) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Session(config)) +} + +func (r rAMInstallationTypeContentDo) Clauses(conds ...clause.Expression) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r rAMInstallationTypeContentDo) Returning(value interface{}, columns ...string) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r rAMInstallationTypeContentDo) Not(conds ...gen.Condition) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r rAMInstallationTypeContentDo) Or(conds ...gen.Condition) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r rAMInstallationTypeContentDo) Select(conds ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r rAMInstallationTypeContentDo) Where(conds ...gen.Condition) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r rAMInstallationTypeContentDo) Order(conds ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r rAMInstallationTypeContentDo) Distinct(cols ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r rAMInstallationTypeContentDo) Omit(cols ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r rAMInstallationTypeContentDo) Join(table schema.Tabler, on ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r rAMInstallationTypeContentDo) LeftJoin(table schema.Tabler, on ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r rAMInstallationTypeContentDo) RightJoin(table schema.Tabler, on ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r rAMInstallationTypeContentDo) Group(cols ...field.Expr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r rAMInstallationTypeContentDo) Having(conds ...gen.Condition) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r rAMInstallationTypeContentDo) Limit(limit int) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r rAMInstallationTypeContentDo) Offset(offset int) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r rAMInstallationTypeContentDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r rAMInstallationTypeContentDo) Unscoped() *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r rAMInstallationTypeContentDo) Create(values ...*models.RAMInstallationTypeContent) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r rAMInstallationTypeContentDo) CreateInBatches(values []*models.RAMInstallationTypeContent, batchSize int) error { + return r.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 (r rAMInstallationTypeContentDo) Save(values ...*models.RAMInstallationTypeContent) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r rAMInstallationTypeContentDo) First() (*models.RAMInstallationTypeContent, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.RAMInstallationTypeContent), nil + } +} + +func (r rAMInstallationTypeContentDo) Take() (*models.RAMInstallationTypeContent, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.RAMInstallationTypeContent), nil + } +} + +func (r rAMInstallationTypeContentDo) Last() (*models.RAMInstallationTypeContent, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.RAMInstallationTypeContent), nil + } +} + +func (r rAMInstallationTypeContentDo) Find() ([]*models.RAMInstallationTypeContent, error) { + result, err := r.DO.Find() + return result.([]*models.RAMInstallationTypeContent), err +} + +func (r rAMInstallationTypeContentDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.RAMInstallationTypeContent, err error) { + buf := make([]*models.RAMInstallationTypeContent, 0, batchSize) + err = r.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 (r rAMInstallationTypeContentDo) FindInBatches(result *[]*models.RAMInstallationTypeContent, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r rAMInstallationTypeContentDo) Attrs(attrs ...field.AssignExpr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r rAMInstallationTypeContentDo) Assign(attrs ...field.AssignExpr) *rAMInstallationTypeContentDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r rAMInstallationTypeContentDo) Joins(fields ...field.RelationField) *rAMInstallationTypeContentDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r rAMInstallationTypeContentDo) Preload(fields ...field.RelationField) *rAMInstallationTypeContentDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r rAMInstallationTypeContentDo) FirstOrInit() (*models.RAMInstallationTypeContent, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.RAMInstallationTypeContent), nil + } +} + +func (r rAMInstallationTypeContentDo) FirstOrCreate() (*models.RAMInstallationTypeContent, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.RAMInstallationTypeContent), nil + } +} + +func (r rAMInstallationTypeContentDo) FindByPage(offset int, limit int) (result []*models.RAMInstallationTypeContent, count int64, err error) { + result, err = r.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 = r.Offset(-1).Limit(-1).Count() + return +} + +func (r rAMInstallationTypeContentDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r rAMInstallationTypeContentDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r rAMInstallationTypeContentDo) Delete(models ...*models.RAMInstallationTypeContent) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *rAMInstallationTypeContentDo) withDO(do gen.Dao) *rAMInstallationTypeContentDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/models/skinlicense.gen.go b/models/skinlicense.gen.go new file mode 100644 index 0000000..d1e8a11 --- /dev/null +++ b/models/skinlicense.gen.go @@ -0,0 +1,337 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newSkinLicense(db *gorm.DB, opts ...gen.DOOption) skinLicense { + _skinLicense := skinLicense{} + + _skinLicense.skinLicenseDo.UseDB(db, opts...) + _skinLicense.skinLicenseDo.UseModel(&models.SkinLicense{}) + + tableName := _skinLicense.skinLicenseDo.TableName() + _skinLicense.ALL = field.NewAsterisk(tableName) + _skinLicense.LicenseTypeID = field.NewInt32(tableName, "licenseTypeID") + _skinLicense.Duration = field.NewInt32(tableName, "duration") + _skinLicense.SkinID = field.NewInt32(tableName, "skinID") + + _skinLicense.fillFieldMap() + + return _skinLicense +} + +type skinLicense struct { + skinLicenseDo skinLicenseDo + + ALL field.Asterisk + LicenseTypeID field.Int32 + Duration field.Int32 + SkinID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s skinLicense) Table(newTableName string) *skinLicense { + s.skinLicenseDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s skinLicense) As(alias string) *skinLicense { + s.skinLicenseDo.DO = *(s.skinLicenseDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *skinLicense) updateTableName(table string) *skinLicense { + s.ALL = field.NewAsterisk(table) + s.LicenseTypeID = field.NewInt32(table, "licenseTypeID") + s.Duration = field.NewInt32(table, "duration") + s.SkinID = field.NewInt32(table, "skinID") + + s.fillFieldMap() + + return s +} + +func (s *skinLicense) WithContext(ctx context.Context) *skinLicenseDo { + return s.skinLicenseDo.WithContext(ctx) +} + +func (s skinLicense) TableName() string { return s.skinLicenseDo.TableName() } + +func (s skinLicense) Alias() string { return s.skinLicenseDo.Alias() } + +func (s skinLicense) Columns(cols ...field.Expr) gen.Columns { return s.skinLicenseDo.Columns(cols...) } + +func (s *skinLicense) 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 *skinLicense) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 3) + s.fieldMap["licenseTypeID"] = s.LicenseTypeID + s.fieldMap["duration"] = s.Duration + s.fieldMap["skinID"] = s.SkinID +} + +func (s skinLicense) clone(db *gorm.DB) skinLicense { + s.skinLicenseDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s skinLicense) replaceDB(db *gorm.DB) skinLicense { + s.skinLicenseDo.ReplaceDB(db) + return s +} + +type skinLicenseDo struct{ gen.DO } + +func (s skinLicenseDo) Debug() *skinLicenseDo { + return s.withDO(s.DO.Debug()) +} + +func (s skinLicenseDo) WithContext(ctx context.Context) *skinLicenseDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s skinLicenseDo) ReadDB() *skinLicenseDo { + return s.Clauses(dbresolver.Read) +} + +func (s skinLicenseDo) WriteDB() *skinLicenseDo { + return s.Clauses(dbresolver.Write) +} + +func (s skinLicenseDo) Session(config *gorm.Session) *skinLicenseDo { + return s.withDO(s.DO.Session(config)) +} + +func (s skinLicenseDo) Clauses(conds ...clause.Expression) *skinLicenseDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s skinLicenseDo) Returning(value interface{}, columns ...string) *skinLicenseDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s skinLicenseDo) Not(conds ...gen.Condition) *skinLicenseDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s skinLicenseDo) Or(conds ...gen.Condition) *skinLicenseDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s skinLicenseDo) Select(conds ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s skinLicenseDo) Where(conds ...gen.Condition) *skinLicenseDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s skinLicenseDo) Order(conds ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s skinLicenseDo) Distinct(cols ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s skinLicenseDo) Omit(cols ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s skinLicenseDo) Join(table schema.Tabler, on ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s skinLicenseDo) LeftJoin(table schema.Tabler, on ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s skinLicenseDo) RightJoin(table schema.Tabler, on ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s skinLicenseDo) Group(cols ...field.Expr) *skinLicenseDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s skinLicenseDo) Having(conds ...gen.Condition) *skinLicenseDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s skinLicenseDo) Limit(limit int) *skinLicenseDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s skinLicenseDo) Offset(offset int) *skinLicenseDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s skinLicenseDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *skinLicenseDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s skinLicenseDo) Unscoped() *skinLicenseDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s skinLicenseDo) Create(values ...*models.SkinLicense) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s skinLicenseDo) CreateInBatches(values []*models.SkinLicense, 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 skinLicenseDo) Save(values ...*models.SkinLicense) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s skinLicenseDo) First() (*models.SkinLicense, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.SkinLicense), nil + } +} + +func (s skinLicenseDo) Take() (*models.SkinLicense, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.SkinLicense), nil + } +} + +func (s skinLicenseDo) Last() (*models.SkinLicense, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.SkinLicense), nil + } +} + +func (s skinLicenseDo) Find() ([]*models.SkinLicense, error) { + result, err := s.DO.Find() + return result.([]*models.SkinLicense), err +} + +func (s skinLicenseDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.SkinLicense, err error) { + buf := make([]*models.SkinLicense, 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 skinLicenseDo) FindInBatches(result *[]*models.SkinLicense, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s skinLicenseDo) Attrs(attrs ...field.AssignExpr) *skinLicenseDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s skinLicenseDo) Assign(attrs ...field.AssignExpr) *skinLicenseDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s skinLicenseDo) Joins(fields ...field.RelationField) *skinLicenseDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s skinLicenseDo) Preload(fields ...field.RelationField) *skinLicenseDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s skinLicenseDo) FirstOrInit() (*models.SkinLicense, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.SkinLicense), nil + } +} + +func (s skinLicenseDo) FirstOrCreate() (*models.SkinLicense, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.SkinLicense), nil + } +} + +func (s skinLicenseDo) FindByPage(offset int, limit int) (result []*models.SkinLicense, 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 skinLicenseDo) 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 skinLicenseDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s skinLicenseDo) Delete(models ...*models.SkinLicense) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *skinLicenseDo) withDO(do gen.Dao) *skinLicenseDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/skinmaterials.gen.go b/models/skinmaterials.gen.go new file mode 100644 index 0000000..4f12104 --- /dev/null +++ b/models/skinmaterials.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newSkinMaterial(db *gorm.DB, opts ...gen.DOOption) skinMaterial { + _skinMaterial := skinMaterial{} + + _skinMaterial.skinMaterialDo.UseDB(db, opts...) + _skinMaterial.skinMaterialDo.UseModel(&models.SkinMaterial{}) + + tableName := _skinMaterial.skinMaterialDo.TableName() + _skinMaterial.ALL = field.NewAsterisk(tableName) + _skinMaterial.SkinMaterialID = field.NewInt32(tableName, "skinMaterialID") + _skinMaterial.DisplayNameID = field.NewInt32(tableName, "displayNameID") + _skinMaterial.MaterialSetID = field.NewInt32(tableName, "materialSetID") + + _skinMaterial.fillFieldMap() + + return _skinMaterial +} + +type skinMaterial struct { + skinMaterialDo skinMaterialDo + + ALL field.Asterisk + SkinMaterialID field.Int32 + DisplayNameID field.Int32 + MaterialSetID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s skinMaterial) Table(newTableName string) *skinMaterial { + s.skinMaterialDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s skinMaterial) As(alias string) *skinMaterial { + s.skinMaterialDo.DO = *(s.skinMaterialDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *skinMaterial) updateTableName(table string) *skinMaterial { + s.ALL = field.NewAsterisk(table) + s.SkinMaterialID = field.NewInt32(table, "skinMaterialID") + s.DisplayNameID = field.NewInt32(table, "displayNameID") + s.MaterialSetID = field.NewInt32(table, "materialSetID") + + s.fillFieldMap() + + return s +} + +func (s *skinMaterial) WithContext(ctx context.Context) *skinMaterialDo { + return s.skinMaterialDo.WithContext(ctx) +} + +func (s skinMaterial) TableName() string { return s.skinMaterialDo.TableName() } + +func (s skinMaterial) Alias() string { return s.skinMaterialDo.Alias() } + +func (s skinMaterial) Columns(cols ...field.Expr) gen.Columns { + return s.skinMaterialDo.Columns(cols...) +} + +func (s *skinMaterial) 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 *skinMaterial) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 3) + s.fieldMap["skinMaterialID"] = s.SkinMaterialID + s.fieldMap["displayNameID"] = s.DisplayNameID + s.fieldMap["materialSetID"] = s.MaterialSetID +} + +func (s skinMaterial) clone(db *gorm.DB) skinMaterial { + s.skinMaterialDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s skinMaterial) replaceDB(db *gorm.DB) skinMaterial { + s.skinMaterialDo.ReplaceDB(db) + return s +} + +type skinMaterialDo struct{ gen.DO } + +func (s skinMaterialDo) Debug() *skinMaterialDo { + return s.withDO(s.DO.Debug()) +} + +func (s skinMaterialDo) WithContext(ctx context.Context) *skinMaterialDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s skinMaterialDo) ReadDB() *skinMaterialDo { + return s.Clauses(dbresolver.Read) +} + +func (s skinMaterialDo) WriteDB() *skinMaterialDo { + return s.Clauses(dbresolver.Write) +} + +func (s skinMaterialDo) Session(config *gorm.Session) *skinMaterialDo { + return s.withDO(s.DO.Session(config)) +} + +func (s skinMaterialDo) Clauses(conds ...clause.Expression) *skinMaterialDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s skinMaterialDo) Returning(value interface{}, columns ...string) *skinMaterialDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s skinMaterialDo) Not(conds ...gen.Condition) *skinMaterialDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s skinMaterialDo) Or(conds ...gen.Condition) *skinMaterialDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s skinMaterialDo) Select(conds ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s skinMaterialDo) Where(conds ...gen.Condition) *skinMaterialDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s skinMaterialDo) Order(conds ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s skinMaterialDo) Distinct(cols ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s skinMaterialDo) Omit(cols ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s skinMaterialDo) Join(table schema.Tabler, on ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s skinMaterialDo) LeftJoin(table schema.Tabler, on ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s skinMaterialDo) RightJoin(table schema.Tabler, on ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s skinMaterialDo) Group(cols ...field.Expr) *skinMaterialDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s skinMaterialDo) Having(conds ...gen.Condition) *skinMaterialDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s skinMaterialDo) Limit(limit int) *skinMaterialDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s skinMaterialDo) Offset(offset int) *skinMaterialDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s skinMaterialDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *skinMaterialDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s skinMaterialDo) Unscoped() *skinMaterialDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s skinMaterialDo) Create(values ...*models.SkinMaterial) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s skinMaterialDo) CreateInBatches(values []*models.SkinMaterial, 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 skinMaterialDo) Save(values ...*models.SkinMaterial) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s skinMaterialDo) First() (*models.SkinMaterial, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.SkinMaterial), nil + } +} + +func (s skinMaterialDo) Take() (*models.SkinMaterial, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.SkinMaterial), nil + } +} + +func (s skinMaterialDo) Last() (*models.SkinMaterial, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.SkinMaterial), nil + } +} + +func (s skinMaterialDo) Find() ([]*models.SkinMaterial, error) { + result, err := s.DO.Find() + return result.([]*models.SkinMaterial), err +} + +func (s skinMaterialDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.SkinMaterial, err error) { + buf := make([]*models.SkinMaterial, 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 skinMaterialDo) FindInBatches(result *[]*models.SkinMaterial, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s skinMaterialDo) Attrs(attrs ...field.AssignExpr) *skinMaterialDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s skinMaterialDo) Assign(attrs ...field.AssignExpr) *skinMaterialDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s skinMaterialDo) Joins(fields ...field.RelationField) *skinMaterialDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s skinMaterialDo) Preload(fields ...field.RelationField) *skinMaterialDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s skinMaterialDo) FirstOrInit() (*models.SkinMaterial, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.SkinMaterial), nil + } +} + +func (s skinMaterialDo) FirstOrCreate() (*models.SkinMaterial, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.SkinMaterial), nil + } +} + +func (s skinMaterialDo) FindByPage(offset int, limit int) (result []*models.SkinMaterial, 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 skinMaterialDo) 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 skinMaterialDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s skinMaterialDo) Delete(models ...*models.SkinMaterial) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *skinMaterialDo) withDO(do gen.Dao) *skinMaterialDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/skins.gen.go b/models/skins.gen.go new file mode 100644 index 0000000..34ac348 --- /dev/null +++ b/models/skins.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newSkin(db *gorm.DB, opts ...gen.DOOption) skin { + _skin := skin{} + + _skin.skinDo.UseDB(db, opts...) + _skin.skinDo.UseModel(&models.Skin{}) + + tableName := _skin.skinDo.TableName() + _skin.ALL = field.NewAsterisk(tableName) + _skin.SkinID = field.NewInt32(tableName, "skinID") + _skin.InternalName = field.NewString(tableName, "internalName") + _skin.SkinMaterialID = field.NewInt32(tableName, "skinMaterialID") + + _skin.fillFieldMap() + + return _skin +} + +type skin struct { + skinDo skinDo + + ALL field.Asterisk + SkinID field.Int32 + InternalName field.String + SkinMaterialID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s skin) Table(newTableName string) *skin { + s.skinDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s skin) As(alias string) *skin { + s.skinDo.DO = *(s.skinDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *skin) updateTableName(table string) *skin { + s.ALL = field.NewAsterisk(table) + s.SkinID = field.NewInt32(table, "skinID") + s.InternalName = field.NewString(table, "internalName") + s.SkinMaterialID = field.NewInt32(table, "skinMaterialID") + + s.fillFieldMap() + + return s +} + +func (s *skin) WithContext(ctx context.Context) *skinDo { return s.skinDo.WithContext(ctx) } + +func (s skin) TableName() string { return s.skinDo.TableName() } + +func (s skin) Alias() string { return s.skinDo.Alias() } + +func (s skin) Columns(cols ...field.Expr) gen.Columns { return s.skinDo.Columns(cols...) } + +func (s *skin) 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 *skin) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 3) + s.fieldMap["skinID"] = s.SkinID + s.fieldMap["internalName"] = s.InternalName + s.fieldMap["skinMaterialID"] = s.SkinMaterialID +} + +func (s skin) clone(db *gorm.DB) skin { + s.skinDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s skin) replaceDB(db *gorm.DB) skin { + s.skinDo.ReplaceDB(db) + return s +} + +type skinDo struct{ gen.DO } + +func (s skinDo) Debug() *skinDo { + return s.withDO(s.DO.Debug()) +} + +func (s skinDo) WithContext(ctx context.Context) *skinDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s skinDo) ReadDB() *skinDo { + return s.Clauses(dbresolver.Read) +} + +func (s skinDo) WriteDB() *skinDo { + return s.Clauses(dbresolver.Write) +} + +func (s skinDo) Session(config *gorm.Session) *skinDo { + return s.withDO(s.DO.Session(config)) +} + +func (s skinDo) Clauses(conds ...clause.Expression) *skinDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s skinDo) Returning(value interface{}, columns ...string) *skinDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s skinDo) Not(conds ...gen.Condition) *skinDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s skinDo) Or(conds ...gen.Condition) *skinDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s skinDo) Select(conds ...field.Expr) *skinDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s skinDo) Where(conds ...gen.Condition) *skinDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s skinDo) Order(conds ...field.Expr) *skinDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s skinDo) Distinct(cols ...field.Expr) *skinDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s skinDo) Omit(cols ...field.Expr) *skinDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s skinDo) Join(table schema.Tabler, on ...field.Expr) *skinDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s skinDo) LeftJoin(table schema.Tabler, on ...field.Expr) *skinDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s skinDo) RightJoin(table schema.Tabler, on ...field.Expr) *skinDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s skinDo) Group(cols ...field.Expr) *skinDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s skinDo) Having(conds ...gen.Condition) *skinDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s skinDo) Limit(limit int) *skinDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s skinDo) Offset(offset int) *skinDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s skinDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *skinDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s skinDo) Unscoped() *skinDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s skinDo) Create(values ...*models.Skin) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s skinDo) CreateInBatches(values []*models.Skin, 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 skinDo) Save(values ...*models.Skin) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s skinDo) First() (*models.Skin, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.Skin), nil + } +} + +func (s skinDo) Take() (*models.Skin, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.Skin), nil + } +} + +func (s skinDo) Last() (*models.Skin, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.Skin), nil + } +} + +func (s skinDo) Find() ([]*models.Skin, error) { + result, err := s.DO.Find() + return result.([]*models.Skin), err +} + +func (s skinDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.Skin, err error) { + buf := make([]*models.Skin, 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 skinDo) FindInBatches(result *[]*models.Skin, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s skinDo) Attrs(attrs ...field.AssignExpr) *skinDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s skinDo) Assign(attrs ...field.AssignExpr) *skinDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s skinDo) Joins(fields ...field.RelationField) *skinDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s skinDo) Preload(fields ...field.RelationField) *skinDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s skinDo) FirstOrInit() (*models.Skin, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.Skin), nil + } +} + +func (s skinDo) FirstOrCreate() (*models.Skin, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.Skin), nil + } +} + +func (s skinDo) FindByPage(offset int, limit int) (result []*models.Skin, 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 skinDo) 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 skinDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s skinDo) Delete(models ...*models.Skin) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *skinDo) withDO(do gen.Dao) *skinDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/skinship.gen.go b/models/skinship.gen.go new file mode 100644 index 0000000..ca794bf --- /dev/null +++ b/models/skinship.gen.go @@ -0,0 +1,331 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newSkinShip(db *gorm.DB, opts ...gen.DOOption) skinShip { + _skinShip := skinShip{} + + _skinShip.skinShipDo.UseDB(db, opts...) + _skinShip.skinShipDo.UseModel(&models.SkinShip{}) + + tableName := _skinShip.skinShipDo.TableName() + _skinShip.ALL = field.NewAsterisk(tableName) + _skinShip.SkinID = field.NewInt32(tableName, "skinID") + _skinShip.TypeID = field.NewInt32(tableName, "typeID") + + _skinShip.fillFieldMap() + + return _skinShip +} + +type skinShip struct { + skinShipDo skinShipDo + + ALL field.Asterisk + SkinID field.Int32 + TypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s skinShip) Table(newTableName string) *skinShip { + s.skinShipDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s skinShip) As(alias string) *skinShip { + s.skinShipDo.DO = *(s.skinShipDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *skinShip) updateTableName(table string) *skinShip { + s.ALL = field.NewAsterisk(table) + s.SkinID = field.NewInt32(table, "skinID") + s.TypeID = field.NewInt32(table, "typeID") + + s.fillFieldMap() + + return s +} + +func (s *skinShip) WithContext(ctx context.Context) *skinShipDo { return s.skinShipDo.WithContext(ctx) } + +func (s skinShip) TableName() string { return s.skinShipDo.TableName() } + +func (s skinShip) Alias() string { return s.skinShipDo.Alias() } + +func (s skinShip) Columns(cols ...field.Expr) gen.Columns { return s.skinShipDo.Columns(cols...) } + +func (s *skinShip) 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 *skinShip) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 2) + s.fieldMap["skinID"] = s.SkinID + s.fieldMap["typeID"] = s.TypeID +} + +func (s skinShip) clone(db *gorm.DB) skinShip { + s.skinShipDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s skinShip) replaceDB(db *gorm.DB) skinShip { + s.skinShipDo.ReplaceDB(db) + return s +} + +type skinShipDo struct{ gen.DO } + +func (s skinShipDo) Debug() *skinShipDo { + return s.withDO(s.DO.Debug()) +} + +func (s skinShipDo) WithContext(ctx context.Context) *skinShipDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s skinShipDo) ReadDB() *skinShipDo { + return s.Clauses(dbresolver.Read) +} + +func (s skinShipDo) WriteDB() *skinShipDo { + return s.Clauses(dbresolver.Write) +} + +func (s skinShipDo) Session(config *gorm.Session) *skinShipDo { + return s.withDO(s.DO.Session(config)) +} + +func (s skinShipDo) Clauses(conds ...clause.Expression) *skinShipDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s skinShipDo) Returning(value interface{}, columns ...string) *skinShipDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s skinShipDo) Not(conds ...gen.Condition) *skinShipDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s skinShipDo) Or(conds ...gen.Condition) *skinShipDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s skinShipDo) Select(conds ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s skinShipDo) Where(conds ...gen.Condition) *skinShipDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s skinShipDo) Order(conds ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s skinShipDo) Distinct(cols ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s skinShipDo) Omit(cols ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s skinShipDo) Join(table schema.Tabler, on ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s skinShipDo) LeftJoin(table schema.Tabler, on ...field.Expr) *skinShipDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s skinShipDo) RightJoin(table schema.Tabler, on ...field.Expr) *skinShipDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s skinShipDo) Group(cols ...field.Expr) *skinShipDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s skinShipDo) Having(conds ...gen.Condition) *skinShipDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s skinShipDo) Limit(limit int) *skinShipDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s skinShipDo) Offset(offset int) *skinShipDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s skinShipDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *skinShipDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s skinShipDo) Unscoped() *skinShipDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s skinShipDo) Create(values ...*models.SkinShip) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s skinShipDo) CreateInBatches(values []*models.SkinShip, 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 skinShipDo) Save(values ...*models.SkinShip) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s skinShipDo) First() (*models.SkinShip, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.SkinShip), nil + } +} + +func (s skinShipDo) Take() (*models.SkinShip, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.SkinShip), nil + } +} + +func (s skinShipDo) Last() (*models.SkinShip, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.SkinShip), nil + } +} + +func (s skinShipDo) Find() ([]*models.SkinShip, error) { + result, err := s.DO.Find() + return result.([]*models.SkinShip), err +} + +func (s skinShipDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.SkinShip, err error) { + buf := make([]*models.SkinShip, 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 skinShipDo) FindInBatches(result *[]*models.SkinShip, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s skinShipDo) Attrs(attrs ...field.AssignExpr) *skinShipDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s skinShipDo) Assign(attrs ...field.AssignExpr) *skinShipDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s skinShipDo) Joins(fields ...field.RelationField) *skinShipDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s skinShipDo) Preload(fields ...field.RelationField) *skinShipDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s skinShipDo) FirstOrInit() (*models.SkinShip, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.SkinShip), nil + } +} + +func (s skinShipDo) FirstOrCreate() (*models.SkinShip, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.SkinShip), nil + } +} + +func (s skinShipDo) FindByPage(offset int, limit int) (result []*models.SkinShip, 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 skinShipDo) 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 skinShipDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s skinShipDo) Delete(models ...*models.SkinShip) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *skinShipDo) withDO(do gen.Dao) *skinShipDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/staoperations.gen.go b/models/staoperations.gen.go new file mode 100644 index 0000000..4eb5dc6 --- /dev/null +++ b/models/staoperations.gen.go @@ -0,0 +1,383 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newStaOperation(db *gorm.DB, opts ...gen.DOOption) staOperation { + _staOperation := staOperation{} + + _staOperation.staOperationDo.UseDB(db, opts...) + _staOperation.staOperationDo.UseModel(&models.StaOperation{}) + + tableName := _staOperation.staOperationDo.TableName() + _staOperation.ALL = field.NewAsterisk(tableName) + _staOperation.ActivityID = field.NewInt32(tableName, "activityID") + _staOperation.OperationID = field.NewInt32(tableName, "operationID") + _staOperation.OperationName = field.NewString(tableName, "operationName") + _staOperation.Description = field.NewString(tableName, "description") + _staOperation.Fringe = field.NewInt32(tableName, "fringe") + _staOperation.Corridor = field.NewInt32(tableName, "corridor") + _staOperation.Hub = field.NewInt32(tableName, "hub") + _staOperation.Border = field.NewInt32(tableName, "border") + _staOperation.Ratio = field.NewInt32(tableName, "ratio") + _staOperation.CaldariStationTypeID = field.NewInt32(tableName, "caldariStationTypeID") + _staOperation.MinmatarStationTypeID = field.NewInt32(tableName, "minmatarStationTypeID") + _staOperation.AmarrStationTypeID = field.NewInt32(tableName, "amarrStationTypeID") + _staOperation.GallenteStationTypeID = field.NewInt32(tableName, "gallenteStationTypeID") + _staOperation.JoveStationTypeID = field.NewInt32(tableName, "joveStationTypeID") + + _staOperation.fillFieldMap() + + return _staOperation +} + +type staOperation struct { + staOperationDo staOperationDo + + ALL field.Asterisk + ActivityID field.Int32 + OperationID field.Int32 + OperationName field.String + Description field.String + Fringe field.Int32 + Corridor field.Int32 + Hub field.Int32 + Border field.Int32 + Ratio field.Int32 + CaldariStationTypeID field.Int32 + MinmatarStationTypeID field.Int32 + AmarrStationTypeID field.Int32 + GallenteStationTypeID field.Int32 + JoveStationTypeID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s staOperation) Table(newTableName string) *staOperation { + s.staOperationDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s staOperation) As(alias string) *staOperation { + s.staOperationDo.DO = *(s.staOperationDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *staOperation) updateTableName(table string) *staOperation { + s.ALL = field.NewAsterisk(table) + s.ActivityID = field.NewInt32(table, "activityID") + s.OperationID = field.NewInt32(table, "operationID") + s.OperationName = field.NewString(table, "operationName") + s.Description = field.NewString(table, "description") + s.Fringe = field.NewInt32(table, "fringe") + s.Corridor = field.NewInt32(table, "corridor") + s.Hub = field.NewInt32(table, "hub") + s.Border = field.NewInt32(table, "border") + s.Ratio = field.NewInt32(table, "ratio") + s.CaldariStationTypeID = field.NewInt32(table, "caldariStationTypeID") + s.MinmatarStationTypeID = field.NewInt32(table, "minmatarStationTypeID") + s.AmarrStationTypeID = field.NewInt32(table, "amarrStationTypeID") + s.GallenteStationTypeID = field.NewInt32(table, "gallenteStationTypeID") + s.JoveStationTypeID = field.NewInt32(table, "joveStationTypeID") + + s.fillFieldMap() + + return s +} + +func (s *staOperation) WithContext(ctx context.Context) *staOperationDo { + return s.staOperationDo.WithContext(ctx) +} + +func (s staOperation) TableName() string { return s.staOperationDo.TableName() } + +func (s staOperation) Alias() string { return s.staOperationDo.Alias() } + +func (s staOperation) Columns(cols ...field.Expr) gen.Columns { + return s.staOperationDo.Columns(cols...) +} + +func (s *staOperation) 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 *staOperation) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 14) + s.fieldMap["activityID"] = s.ActivityID + s.fieldMap["operationID"] = s.OperationID + s.fieldMap["operationName"] = s.OperationName + s.fieldMap["description"] = s.Description + s.fieldMap["fringe"] = s.Fringe + s.fieldMap["corridor"] = s.Corridor + s.fieldMap["hub"] = s.Hub + s.fieldMap["border"] = s.Border + s.fieldMap["ratio"] = s.Ratio + s.fieldMap["caldariStationTypeID"] = s.CaldariStationTypeID + s.fieldMap["minmatarStationTypeID"] = s.MinmatarStationTypeID + s.fieldMap["amarrStationTypeID"] = s.AmarrStationTypeID + s.fieldMap["gallenteStationTypeID"] = s.GallenteStationTypeID + s.fieldMap["joveStationTypeID"] = s.JoveStationTypeID +} + +func (s staOperation) clone(db *gorm.DB) staOperation { + s.staOperationDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s staOperation) replaceDB(db *gorm.DB) staOperation { + s.staOperationDo.ReplaceDB(db) + return s +} + +type staOperationDo struct{ gen.DO } + +func (s staOperationDo) Debug() *staOperationDo { + return s.withDO(s.DO.Debug()) +} + +func (s staOperationDo) WithContext(ctx context.Context) *staOperationDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s staOperationDo) ReadDB() *staOperationDo { + return s.Clauses(dbresolver.Read) +} + +func (s staOperationDo) WriteDB() *staOperationDo { + return s.Clauses(dbresolver.Write) +} + +func (s staOperationDo) Session(config *gorm.Session) *staOperationDo { + return s.withDO(s.DO.Session(config)) +} + +func (s staOperationDo) Clauses(conds ...clause.Expression) *staOperationDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s staOperationDo) Returning(value interface{}, columns ...string) *staOperationDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s staOperationDo) Not(conds ...gen.Condition) *staOperationDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s staOperationDo) Or(conds ...gen.Condition) *staOperationDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s staOperationDo) Select(conds ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s staOperationDo) Where(conds ...gen.Condition) *staOperationDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s staOperationDo) Order(conds ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s staOperationDo) Distinct(cols ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s staOperationDo) Omit(cols ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s staOperationDo) Join(table schema.Tabler, on ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s staOperationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *staOperationDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s staOperationDo) RightJoin(table schema.Tabler, on ...field.Expr) *staOperationDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s staOperationDo) Group(cols ...field.Expr) *staOperationDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s staOperationDo) Having(conds ...gen.Condition) *staOperationDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s staOperationDo) Limit(limit int) *staOperationDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s staOperationDo) Offset(offset int) *staOperationDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s staOperationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *staOperationDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s staOperationDo) Unscoped() *staOperationDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s staOperationDo) Create(values ...*models.StaOperation) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s staOperationDo) CreateInBatches(values []*models.StaOperation, 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 staOperationDo) Save(values ...*models.StaOperation) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s staOperationDo) First() (*models.StaOperation, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.StaOperation), nil + } +} + +func (s staOperationDo) Take() (*models.StaOperation, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.StaOperation), nil + } +} + +func (s staOperationDo) Last() (*models.StaOperation, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.StaOperation), nil + } +} + +func (s staOperationDo) Find() ([]*models.StaOperation, error) { + result, err := s.DO.Find() + return result.([]*models.StaOperation), err +} + +func (s staOperationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.StaOperation, err error) { + buf := make([]*models.StaOperation, 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 staOperationDo) FindInBatches(result *[]*models.StaOperation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s staOperationDo) Attrs(attrs ...field.AssignExpr) *staOperationDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s staOperationDo) Assign(attrs ...field.AssignExpr) *staOperationDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s staOperationDo) Joins(fields ...field.RelationField) *staOperationDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s staOperationDo) Preload(fields ...field.RelationField) *staOperationDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s staOperationDo) FirstOrInit() (*models.StaOperation, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.StaOperation), nil + } +} + +func (s staOperationDo) FirstOrCreate() (*models.StaOperation, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.StaOperation), nil + } +} + +func (s staOperationDo) FindByPage(offset int, limit int) (result []*models.StaOperation, 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 staOperationDo) 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 staOperationDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s staOperationDo) Delete(models ...*models.StaOperation) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *staOperationDo) withDO(do gen.Dao) *staOperationDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/staoperationservices.gen.go b/models/staoperationservices.gen.go new file mode 100644 index 0000000..2406a21 --- /dev/null +++ b/models/staoperationservices.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newStaOperationService(db *gorm.DB, opts ...gen.DOOption) staOperationService { + _staOperationService := staOperationService{} + + _staOperationService.staOperationServiceDo.UseDB(db, opts...) + _staOperationService.staOperationServiceDo.UseModel(&models.StaOperationService{}) + + tableName := _staOperationService.staOperationServiceDo.TableName() + _staOperationService.ALL = field.NewAsterisk(tableName) + _staOperationService.OperationID = field.NewInt32(tableName, "operationID") + _staOperationService.ServiceID = field.NewInt32(tableName, "serviceID") + + _staOperationService.fillFieldMap() + + return _staOperationService +} + +type staOperationService struct { + staOperationServiceDo staOperationServiceDo + + ALL field.Asterisk + OperationID field.Int32 + ServiceID field.Int32 + + fieldMap map[string]field.Expr +} + +func (s staOperationService) Table(newTableName string) *staOperationService { + s.staOperationServiceDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s staOperationService) As(alias string) *staOperationService { + s.staOperationServiceDo.DO = *(s.staOperationServiceDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *staOperationService) updateTableName(table string) *staOperationService { + s.ALL = field.NewAsterisk(table) + s.OperationID = field.NewInt32(table, "operationID") + s.ServiceID = field.NewInt32(table, "serviceID") + + s.fillFieldMap() + + return s +} + +func (s *staOperationService) WithContext(ctx context.Context) *staOperationServiceDo { + return s.staOperationServiceDo.WithContext(ctx) +} + +func (s staOperationService) TableName() string { return s.staOperationServiceDo.TableName() } + +func (s staOperationService) Alias() string { return s.staOperationServiceDo.Alias() } + +func (s staOperationService) Columns(cols ...field.Expr) gen.Columns { + return s.staOperationServiceDo.Columns(cols...) +} + +func (s *staOperationService) 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 *staOperationService) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 2) + s.fieldMap["operationID"] = s.OperationID + s.fieldMap["serviceID"] = s.ServiceID +} + +func (s staOperationService) clone(db *gorm.DB) staOperationService { + s.staOperationServiceDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s staOperationService) replaceDB(db *gorm.DB) staOperationService { + s.staOperationServiceDo.ReplaceDB(db) + return s +} + +type staOperationServiceDo struct{ gen.DO } + +func (s staOperationServiceDo) Debug() *staOperationServiceDo { + return s.withDO(s.DO.Debug()) +} + +func (s staOperationServiceDo) WithContext(ctx context.Context) *staOperationServiceDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s staOperationServiceDo) ReadDB() *staOperationServiceDo { + return s.Clauses(dbresolver.Read) +} + +func (s staOperationServiceDo) WriteDB() *staOperationServiceDo { + return s.Clauses(dbresolver.Write) +} + +func (s staOperationServiceDo) Session(config *gorm.Session) *staOperationServiceDo { + return s.withDO(s.DO.Session(config)) +} + +func (s staOperationServiceDo) Clauses(conds ...clause.Expression) *staOperationServiceDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s staOperationServiceDo) Returning(value interface{}, columns ...string) *staOperationServiceDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s staOperationServiceDo) Not(conds ...gen.Condition) *staOperationServiceDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s staOperationServiceDo) Or(conds ...gen.Condition) *staOperationServiceDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s staOperationServiceDo) Select(conds ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s staOperationServiceDo) Where(conds ...gen.Condition) *staOperationServiceDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s staOperationServiceDo) Order(conds ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s staOperationServiceDo) Distinct(cols ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s staOperationServiceDo) Omit(cols ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s staOperationServiceDo) Join(table schema.Tabler, on ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s staOperationServiceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s staOperationServiceDo) RightJoin(table schema.Tabler, on ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s staOperationServiceDo) Group(cols ...field.Expr) *staOperationServiceDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s staOperationServiceDo) Having(conds ...gen.Condition) *staOperationServiceDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s staOperationServiceDo) Limit(limit int) *staOperationServiceDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s staOperationServiceDo) Offset(offset int) *staOperationServiceDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s staOperationServiceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *staOperationServiceDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s staOperationServiceDo) Unscoped() *staOperationServiceDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s staOperationServiceDo) Create(values ...*models.StaOperationService) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s staOperationServiceDo) CreateInBatches(values []*models.StaOperationService, 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 staOperationServiceDo) Save(values ...*models.StaOperationService) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s staOperationServiceDo) First() (*models.StaOperationService, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.StaOperationService), nil + } +} + +func (s staOperationServiceDo) Take() (*models.StaOperationService, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.StaOperationService), nil + } +} + +func (s staOperationServiceDo) Last() (*models.StaOperationService, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.StaOperationService), nil + } +} + +func (s staOperationServiceDo) Find() ([]*models.StaOperationService, error) { + result, err := s.DO.Find() + return result.([]*models.StaOperationService), err +} + +func (s staOperationServiceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.StaOperationService, err error) { + buf := make([]*models.StaOperationService, 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 staOperationServiceDo) FindInBatches(result *[]*models.StaOperationService, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s staOperationServiceDo) Attrs(attrs ...field.AssignExpr) *staOperationServiceDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s staOperationServiceDo) Assign(attrs ...field.AssignExpr) *staOperationServiceDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s staOperationServiceDo) Joins(fields ...field.RelationField) *staOperationServiceDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s staOperationServiceDo) Preload(fields ...field.RelationField) *staOperationServiceDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s staOperationServiceDo) FirstOrInit() (*models.StaOperationService, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.StaOperationService), nil + } +} + +func (s staOperationServiceDo) FirstOrCreate() (*models.StaOperationService, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.StaOperationService), nil + } +} + +func (s staOperationServiceDo) FindByPage(offset int, limit int) (result []*models.StaOperationService, 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 staOperationServiceDo) 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 staOperationServiceDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s staOperationServiceDo) Delete(models ...*models.StaOperationService) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *staOperationServiceDo) withDO(do gen.Dao) *staOperationServiceDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/staservices.gen.go b/models/staservices.gen.go new file mode 100644 index 0000000..ca79775 --- /dev/null +++ b/models/staservices.gen.go @@ -0,0 +1,337 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newStaService(db *gorm.DB, opts ...gen.DOOption) staService { + _staService := staService{} + + _staService.staServiceDo.UseDB(db, opts...) + _staService.staServiceDo.UseModel(&models.StaService{}) + + tableName := _staService.staServiceDo.TableName() + _staService.ALL = field.NewAsterisk(tableName) + _staService.ServiceID = field.NewInt32(tableName, "serviceID") + _staService.ServiceName = field.NewString(tableName, "serviceName") + _staService.Description = field.NewString(tableName, "description") + + _staService.fillFieldMap() + + return _staService +} + +type staService struct { + staServiceDo staServiceDo + + ALL field.Asterisk + ServiceID field.Int32 + ServiceName field.String + Description field.String + + fieldMap map[string]field.Expr +} + +func (s staService) Table(newTableName string) *staService { + s.staServiceDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s staService) As(alias string) *staService { + s.staServiceDo.DO = *(s.staServiceDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *staService) updateTableName(table string) *staService { + s.ALL = field.NewAsterisk(table) + s.ServiceID = field.NewInt32(table, "serviceID") + s.ServiceName = field.NewString(table, "serviceName") + s.Description = field.NewString(table, "description") + + s.fillFieldMap() + + return s +} + +func (s *staService) WithContext(ctx context.Context) *staServiceDo { + return s.staServiceDo.WithContext(ctx) +} + +func (s staService) TableName() string { return s.staServiceDo.TableName() } + +func (s staService) Alias() string { return s.staServiceDo.Alias() } + +func (s staService) Columns(cols ...field.Expr) gen.Columns { return s.staServiceDo.Columns(cols...) } + +func (s *staService) 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 *staService) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 3) + s.fieldMap["serviceID"] = s.ServiceID + s.fieldMap["serviceName"] = s.ServiceName + s.fieldMap["description"] = s.Description +} + +func (s staService) clone(db *gorm.DB) staService { + s.staServiceDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s staService) replaceDB(db *gorm.DB) staService { + s.staServiceDo.ReplaceDB(db) + return s +} + +type staServiceDo struct{ gen.DO } + +func (s staServiceDo) Debug() *staServiceDo { + return s.withDO(s.DO.Debug()) +} + +func (s staServiceDo) WithContext(ctx context.Context) *staServiceDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s staServiceDo) ReadDB() *staServiceDo { + return s.Clauses(dbresolver.Read) +} + +func (s staServiceDo) WriteDB() *staServiceDo { + return s.Clauses(dbresolver.Write) +} + +func (s staServiceDo) Session(config *gorm.Session) *staServiceDo { + return s.withDO(s.DO.Session(config)) +} + +func (s staServiceDo) Clauses(conds ...clause.Expression) *staServiceDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s staServiceDo) Returning(value interface{}, columns ...string) *staServiceDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s staServiceDo) Not(conds ...gen.Condition) *staServiceDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s staServiceDo) Or(conds ...gen.Condition) *staServiceDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s staServiceDo) Select(conds ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s staServiceDo) Where(conds ...gen.Condition) *staServiceDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s staServiceDo) Order(conds ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s staServiceDo) Distinct(cols ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s staServiceDo) Omit(cols ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s staServiceDo) Join(table schema.Tabler, on ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s staServiceDo) LeftJoin(table schema.Tabler, on ...field.Expr) *staServiceDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s staServiceDo) RightJoin(table schema.Tabler, on ...field.Expr) *staServiceDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s staServiceDo) Group(cols ...field.Expr) *staServiceDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s staServiceDo) Having(conds ...gen.Condition) *staServiceDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s staServiceDo) Limit(limit int) *staServiceDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s staServiceDo) Offset(offset int) *staServiceDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s staServiceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *staServiceDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s staServiceDo) Unscoped() *staServiceDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s staServiceDo) Create(values ...*models.StaService) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s staServiceDo) CreateInBatches(values []*models.StaService, 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 staServiceDo) Save(values ...*models.StaService) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s staServiceDo) First() (*models.StaService, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.StaService), nil + } +} + +func (s staServiceDo) Take() (*models.StaService, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.StaService), nil + } +} + +func (s staServiceDo) Last() (*models.StaService, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.StaService), nil + } +} + +func (s staServiceDo) Find() ([]*models.StaService, error) { + result, err := s.DO.Find() + return result.([]*models.StaService), err +} + +func (s staServiceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.StaService, err error) { + buf := make([]*models.StaService, 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 staServiceDo) FindInBatches(result *[]*models.StaService, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s staServiceDo) Attrs(attrs ...field.AssignExpr) *staServiceDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s staServiceDo) Assign(attrs ...field.AssignExpr) *staServiceDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s staServiceDo) Joins(fields ...field.RelationField) *staServiceDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s staServiceDo) Preload(fields ...field.RelationField) *staServiceDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s staServiceDo) FirstOrInit() (*models.StaService, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.StaService), nil + } +} + +func (s staServiceDo) FirstOrCreate() (*models.StaService, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.StaService), nil + } +} + +func (s staServiceDo) FindByPage(offset int, limit int) (result []*models.StaService, 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 staServiceDo) 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 staServiceDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s staServiceDo) Delete(models ...*models.StaService) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *staServiceDo) withDO(do gen.Dao) *staServiceDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/stastations.gen.go b/models/stastations.gen.go new file mode 100644 index 0000000..ff3da57 --- /dev/null +++ b/models/stastations.gen.go @@ -0,0 +1,397 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newStaStation(db *gorm.DB, opts ...gen.DOOption) staStation { + _staStation := staStation{} + + _staStation.staStationDo.UseDB(db, opts...) + _staStation.staStationDo.UseModel(&models.StaStation{}) + + tableName := _staStation.staStationDo.TableName() + _staStation.ALL = field.NewAsterisk(tableName) + _staStation.StationID = field.NewInt64(tableName, "stationID") + _staStation.Security = field.NewFloat64(tableName, "security") + _staStation.DockingCostPerVolume = field.NewFloat64(tableName, "dockingCostPerVolume") + _staStation.MaxShipVolumeDockable = field.NewFloat64(tableName, "maxShipVolumeDockable") + _staStation.OfficeRentalCost = field.NewInt32(tableName, "officeRentalCost") + _staStation.OperationID = field.NewInt32(tableName, "operationID") + _staStation.StationTypeID = field.NewInt32(tableName, "stationTypeID") + _staStation.CorporationID = field.NewInt32(tableName, "corporationID") + _staStation.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _staStation.ConstellationID = field.NewInt32(tableName, "constellationID") + _staStation.RegionID = field.NewInt32(tableName, "regionID") + _staStation.StationName = field.NewString(tableName, "stationName") + _staStation.X = field.NewFloat64(tableName, "x") + _staStation.Y = field.NewFloat64(tableName, "y") + _staStation.Z = field.NewFloat64(tableName, "z") + _staStation.ReprocessingEfficiency = field.NewFloat64(tableName, "reprocessingEfficiency") + _staStation.ReprocessingStationsTake = field.NewFloat64(tableName, "reprocessingStationsTake") + _staStation.ReprocessingHangarFlag = field.NewInt32(tableName, "reprocessingHangarFlag") + + _staStation.fillFieldMap() + + return _staStation +} + +type staStation struct { + staStationDo staStationDo + + ALL field.Asterisk + StationID field.Int64 + Security field.Float64 + DockingCostPerVolume field.Float64 + MaxShipVolumeDockable field.Float64 + OfficeRentalCost field.Int32 + OperationID field.Int32 + StationTypeID field.Int32 + CorporationID field.Int32 + SolarSystemID field.Int32 + ConstellationID field.Int32 + RegionID field.Int32 + StationName field.String + X field.Float64 + Y field.Float64 + Z field.Float64 + ReprocessingEfficiency field.Float64 + ReprocessingStationsTake field.Float64 + ReprocessingHangarFlag field.Int32 + + fieldMap map[string]field.Expr +} + +func (s staStation) Table(newTableName string) *staStation { + s.staStationDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s staStation) As(alias string) *staStation { + s.staStationDo.DO = *(s.staStationDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *staStation) updateTableName(table string) *staStation { + s.ALL = field.NewAsterisk(table) + s.StationID = field.NewInt64(table, "stationID") + s.Security = field.NewFloat64(table, "security") + s.DockingCostPerVolume = field.NewFloat64(table, "dockingCostPerVolume") + s.MaxShipVolumeDockable = field.NewFloat64(table, "maxShipVolumeDockable") + s.OfficeRentalCost = field.NewInt32(table, "officeRentalCost") + s.OperationID = field.NewInt32(table, "operationID") + s.StationTypeID = field.NewInt32(table, "stationTypeID") + s.CorporationID = field.NewInt32(table, "corporationID") + s.SolarSystemID = field.NewInt32(table, "solarSystemID") + s.ConstellationID = field.NewInt32(table, "constellationID") + s.RegionID = field.NewInt32(table, "regionID") + s.StationName = field.NewString(table, "stationName") + s.X = field.NewFloat64(table, "x") + s.Y = field.NewFloat64(table, "y") + s.Z = field.NewFloat64(table, "z") + s.ReprocessingEfficiency = field.NewFloat64(table, "reprocessingEfficiency") + s.ReprocessingStationsTake = field.NewFloat64(table, "reprocessingStationsTake") + s.ReprocessingHangarFlag = field.NewInt32(table, "reprocessingHangarFlag") + + s.fillFieldMap() + + return s +} + +func (s *staStation) WithContext(ctx context.Context) *staStationDo { + return s.staStationDo.WithContext(ctx) +} + +func (s staStation) TableName() string { return s.staStationDo.TableName() } + +func (s staStation) Alias() string { return s.staStationDo.Alias() } + +func (s staStation) Columns(cols ...field.Expr) gen.Columns { return s.staStationDo.Columns(cols...) } + +func (s *staStation) 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 *staStation) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 18) + s.fieldMap["stationID"] = s.StationID + s.fieldMap["security"] = s.Security + s.fieldMap["dockingCostPerVolume"] = s.DockingCostPerVolume + s.fieldMap["maxShipVolumeDockable"] = s.MaxShipVolumeDockable + s.fieldMap["officeRentalCost"] = s.OfficeRentalCost + s.fieldMap["operationID"] = s.OperationID + s.fieldMap["stationTypeID"] = s.StationTypeID + s.fieldMap["corporationID"] = s.CorporationID + s.fieldMap["solarSystemID"] = s.SolarSystemID + s.fieldMap["constellationID"] = s.ConstellationID + s.fieldMap["regionID"] = s.RegionID + s.fieldMap["stationName"] = s.StationName + s.fieldMap["x"] = s.X + s.fieldMap["y"] = s.Y + s.fieldMap["z"] = s.Z + s.fieldMap["reprocessingEfficiency"] = s.ReprocessingEfficiency + s.fieldMap["reprocessingStationsTake"] = s.ReprocessingStationsTake + s.fieldMap["reprocessingHangarFlag"] = s.ReprocessingHangarFlag +} + +func (s staStation) clone(db *gorm.DB) staStation { + s.staStationDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s staStation) replaceDB(db *gorm.DB) staStation { + s.staStationDo.ReplaceDB(db) + return s +} + +type staStationDo struct{ gen.DO } + +func (s staStationDo) Debug() *staStationDo { + return s.withDO(s.DO.Debug()) +} + +func (s staStationDo) WithContext(ctx context.Context) *staStationDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s staStationDo) ReadDB() *staStationDo { + return s.Clauses(dbresolver.Read) +} + +func (s staStationDo) WriteDB() *staStationDo { + return s.Clauses(dbresolver.Write) +} + +func (s staStationDo) Session(config *gorm.Session) *staStationDo { + return s.withDO(s.DO.Session(config)) +} + +func (s staStationDo) Clauses(conds ...clause.Expression) *staStationDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s staStationDo) Returning(value interface{}, columns ...string) *staStationDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s staStationDo) Not(conds ...gen.Condition) *staStationDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s staStationDo) Or(conds ...gen.Condition) *staStationDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s staStationDo) Select(conds ...field.Expr) *staStationDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s staStationDo) Where(conds ...gen.Condition) *staStationDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s staStationDo) Order(conds ...field.Expr) *staStationDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s staStationDo) Distinct(cols ...field.Expr) *staStationDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s staStationDo) Omit(cols ...field.Expr) *staStationDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s staStationDo) Join(table schema.Tabler, on ...field.Expr) *staStationDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s staStationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *staStationDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s staStationDo) RightJoin(table schema.Tabler, on ...field.Expr) *staStationDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s staStationDo) Group(cols ...field.Expr) *staStationDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s staStationDo) Having(conds ...gen.Condition) *staStationDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s staStationDo) Limit(limit int) *staStationDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s staStationDo) Offset(offset int) *staStationDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s staStationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *staStationDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s staStationDo) Unscoped() *staStationDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s staStationDo) Create(values ...*models.StaStation) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s staStationDo) CreateInBatches(values []*models.StaStation, 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 staStationDo) Save(values ...*models.StaStation) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s staStationDo) First() (*models.StaStation, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.StaStation), nil + } +} + +func (s staStationDo) Take() (*models.StaStation, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.StaStation), nil + } +} + +func (s staStationDo) Last() (*models.StaStation, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.StaStation), nil + } +} + +func (s staStationDo) Find() ([]*models.StaStation, error) { + result, err := s.DO.Find() + return result.([]*models.StaStation), err +} + +func (s staStationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.StaStation, err error) { + buf := make([]*models.StaStation, 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 staStationDo) FindInBatches(result *[]*models.StaStation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s staStationDo) Attrs(attrs ...field.AssignExpr) *staStationDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s staStationDo) Assign(attrs ...field.AssignExpr) *staStationDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s staStationDo) Joins(fields ...field.RelationField) *staStationDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s staStationDo) Preload(fields ...field.RelationField) *staStationDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s staStationDo) FirstOrInit() (*models.StaStation, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.StaStation), nil + } +} + +func (s staStationDo) FirstOrCreate() (*models.StaStation, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.StaStation), nil + } +} + +func (s staStationDo) FindByPage(offset int, limit int) (result []*models.StaStation, 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 staStationDo) 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 staStationDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s staStationDo) Delete(models ...*models.StaStation) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *staStationDo) withDO(do gen.Dao) *staStationDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/stastationtypes.gen.go b/models/stastationtypes.gen.go new file mode 100644 index 0000000..09d7a15 --- /dev/null +++ b/models/stastationtypes.gen.go @@ -0,0 +1,371 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newStaStationType(db *gorm.DB, opts ...gen.DOOption) staStationType { + _staStationType := staStationType{} + + _staStationType.staStationTypeDo.UseDB(db, opts...) + _staStationType.staStationTypeDo.UseModel(&models.StaStationType{}) + + tableName := _staStationType.staStationTypeDo.TableName() + _staStationType.ALL = field.NewAsterisk(tableName) + _staStationType.StationTypeID = field.NewInt32(tableName, "stationTypeID") + _staStationType.DockEntryX = field.NewFloat64(tableName, "dockEntryX") + _staStationType.DockEntryY = field.NewFloat64(tableName, "dockEntryY") + _staStationType.DockEntryZ = field.NewFloat64(tableName, "dockEntryZ") + _staStationType.DockOrientationX = field.NewFloat64(tableName, "dockOrientationX") + _staStationType.DockOrientationY = field.NewFloat64(tableName, "dockOrientationY") + _staStationType.DockOrientationZ = field.NewFloat64(tableName, "dockOrientationZ") + _staStationType.OperationID = field.NewInt32(tableName, "operationID") + _staStationType.OfficeSlots = field.NewInt32(tableName, "officeSlots") + _staStationType.ReprocessingEfficiency = field.NewFloat64(tableName, "reprocessingEfficiency") + _staStationType.Conquerable = field.NewBool(tableName, "conquerable") + + _staStationType.fillFieldMap() + + return _staStationType +} + +type staStationType struct { + staStationTypeDo staStationTypeDo + + ALL field.Asterisk + StationTypeID field.Int32 + DockEntryX field.Float64 + DockEntryY field.Float64 + DockEntryZ field.Float64 + DockOrientationX field.Float64 + DockOrientationY field.Float64 + DockOrientationZ field.Float64 + OperationID field.Int32 + OfficeSlots field.Int32 + ReprocessingEfficiency field.Float64 + Conquerable field.Bool + + fieldMap map[string]field.Expr +} + +func (s staStationType) Table(newTableName string) *staStationType { + s.staStationTypeDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s staStationType) As(alias string) *staStationType { + s.staStationTypeDo.DO = *(s.staStationTypeDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *staStationType) updateTableName(table string) *staStationType { + s.ALL = field.NewAsterisk(table) + s.StationTypeID = field.NewInt32(table, "stationTypeID") + s.DockEntryX = field.NewFloat64(table, "dockEntryX") + s.DockEntryY = field.NewFloat64(table, "dockEntryY") + s.DockEntryZ = field.NewFloat64(table, "dockEntryZ") + s.DockOrientationX = field.NewFloat64(table, "dockOrientationX") + s.DockOrientationY = field.NewFloat64(table, "dockOrientationY") + s.DockOrientationZ = field.NewFloat64(table, "dockOrientationZ") + s.OperationID = field.NewInt32(table, "operationID") + s.OfficeSlots = field.NewInt32(table, "officeSlots") + s.ReprocessingEfficiency = field.NewFloat64(table, "reprocessingEfficiency") + s.Conquerable = field.NewBool(table, "conquerable") + + s.fillFieldMap() + + return s +} + +func (s *staStationType) WithContext(ctx context.Context) *staStationTypeDo { + return s.staStationTypeDo.WithContext(ctx) +} + +func (s staStationType) TableName() string { return s.staStationTypeDo.TableName() } + +func (s staStationType) Alias() string { return s.staStationTypeDo.Alias() } + +func (s staStationType) Columns(cols ...field.Expr) gen.Columns { + return s.staStationTypeDo.Columns(cols...) +} + +func (s *staStationType) 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 *staStationType) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 11) + s.fieldMap["stationTypeID"] = s.StationTypeID + s.fieldMap["dockEntryX"] = s.DockEntryX + s.fieldMap["dockEntryY"] = s.DockEntryY + s.fieldMap["dockEntryZ"] = s.DockEntryZ + s.fieldMap["dockOrientationX"] = s.DockOrientationX + s.fieldMap["dockOrientationY"] = s.DockOrientationY + s.fieldMap["dockOrientationZ"] = s.DockOrientationZ + s.fieldMap["operationID"] = s.OperationID + s.fieldMap["officeSlots"] = s.OfficeSlots + s.fieldMap["reprocessingEfficiency"] = s.ReprocessingEfficiency + s.fieldMap["conquerable"] = s.Conquerable +} + +func (s staStationType) clone(db *gorm.DB) staStationType { + s.staStationTypeDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s staStationType) replaceDB(db *gorm.DB) staStationType { + s.staStationTypeDo.ReplaceDB(db) + return s +} + +type staStationTypeDo struct{ gen.DO } + +func (s staStationTypeDo) Debug() *staStationTypeDo { + return s.withDO(s.DO.Debug()) +} + +func (s staStationTypeDo) WithContext(ctx context.Context) *staStationTypeDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s staStationTypeDo) ReadDB() *staStationTypeDo { + return s.Clauses(dbresolver.Read) +} + +func (s staStationTypeDo) WriteDB() *staStationTypeDo { + return s.Clauses(dbresolver.Write) +} + +func (s staStationTypeDo) Session(config *gorm.Session) *staStationTypeDo { + return s.withDO(s.DO.Session(config)) +} + +func (s staStationTypeDo) Clauses(conds ...clause.Expression) *staStationTypeDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s staStationTypeDo) Returning(value interface{}, columns ...string) *staStationTypeDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s staStationTypeDo) Not(conds ...gen.Condition) *staStationTypeDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s staStationTypeDo) Or(conds ...gen.Condition) *staStationTypeDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s staStationTypeDo) Select(conds ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s staStationTypeDo) Where(conds ...gen.Condition) *staStationTypeDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s staStationTypeDo) Order(conds ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s staStationTypeDo) Distinct(cols ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s staStationTypeDo) Omit(cols ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s staStationTypeDo) Join(table schema.Tabler, on ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s staStationTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s staStationTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s staStationTypeDo) Group(cols ...field.Expr) *staStationTypeDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s staStationTypeDo) Having(conds ...gen.Condition) *staStationTypeDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s staStationTypeDo) Limit(limit int) *staStationTypeDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s staStationTypeDo) Offset(offset int) *staStationTypeDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s staStationTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *staStationTypeDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s staStationTypeDo) Unscoped() *staStationTypeDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s staStationTypeDo) Create(values ...*models.StaStationType) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s staStationTypeDo) CreateInBatches(values []*models.StaStationType, 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 staStationTypeDo) Save(values ...*models.StaStationType) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s staStationTypeDo) First() (*models.StaStationType, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.StaStationType), nil + } +} + +func (s staStationTypeDo) Take() (*models.StaStationType, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.StaStationType), nil + } +} + +func (s staStationTypeDo) Last() (*models.StaStationType, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.StaStationType), nil + } +} + +func (s staStationTypeDo) Find() ([]*models.StaStationType, error) { + result, err := s.DO.Find() + return result.([]*models.StaStationType), err +} + +func (s staStationTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.StaStationType, err error) { + buf := make([]*models.StaStationType, 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 staStationTypeDo) FindInBatches(result *[]*models.StaStationType, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s staStationTypeDo) Attrs(attrs ...field.AssignExpr) *staStationTypeDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s staStationTypeDo) Assign(attrs ...field.AssignExpr) *staStationTypeDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s staStationTypeDo) Joins(fields ...field.RelationField) *staStationTypeDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s staStationTypeDo) Preload(fields ...field.RelationField) *staStationTypeDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s staStationTypeDo) FirstOrInit() (*models.StaStationType, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.StaStationType), nil + } +} + +func (s staStationTypeDo) FirstOrCreate() (*models.StaStationType, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.StaStationType), nil + } +} + +func (s staStationTypeDo) FindByPage(offset int, limit int) (result []*models.StaStationType, 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 staStationTypeDo) 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 staStationTypeDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s staStationTypeDo) Delete(models ...*models.StaStationType) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *staStationTypeDo) withDO(do gen.Dao) *staStationTypeDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/models/translationtables.gen.go b/models/translationtables.gen.go new file mode 100644 index 0000000..82f4ecc --- /dev/null +++ b/models/translationtables.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newTranslationTable(db *gorm.DB, opts ...gen.DOOption) translationTable { + _translationTable := translationTable{} + + _translationTable.translationTableDo.UseDB(db, opts...) + _translationTable.translationTableDo.UseModel(&models.TranslationTable{}) + + tableName := _translationTable.translationTableDo.TableName() + _translationTable.ALL = field.NewAsterisk(tableName) + _translationTable.SourceTable = field.NewString(tableName, "sourceTable") + _translationTable.DestinationTable = field.NewString(tableName, "destinationTable") + _translationTable.TranslatedKey = field.NewString(tableName, "translatedKey") + _translationTable.TcGroupID = field.NewInt32(tableName, "tcGroupID") + _translationTable.TcID = field.NewInt32(tableName, "tcID") + + _translationTable.fillFieldMap() + + return _translationTable +} + +type translationTable struct { + translationTableDo translationTableDo + + ALL field.Asterisk + SourceTable field.String + DestinationTable field.String + TranslatedKey field.String + TcGroupID field.Int32 + TcID field.Int32 + + fieldMap map[string]field.Expr +} + +func (t translationTable) Table(newTableName string) *translationTable { + t.translationTableDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t translationTable) As(alias string) *translationTable { + t.translationTableDo.DO = *(t.translationTableDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *translationTable) updateTableName(table string) *translationTable { + t.ALL = field.NewAsterisk(table) + t.SourceTable = field.NewString(table, "sourceTable") + t.DestinationTable = field.NewString(table, "destinationTable") + t.TranslatedKey = field.NewString(table, "translatedKey") + t.TcGroupID = field.NewInt32(table, "tcGroupID") + t.TcID = field.NewInt32(table, "tcID") + + t.fillFieldMap() + + return t +} + +func (t *translationTable) WithContext(ctx context.Context) *translationTableDo { + return t.translationTableDo.WithContext(ctx) +} + +func (t translationTable) TableName() string { return t.translationTableDo.TableName() } + +func (t translationTable) Alias() string { return t.translationTableDo.Alias() } + +func (t translationTable) Columns(cols ...field.Expr) gen.Columns { + return t.translationTableDo.Columns(cols...) +} + +func (t *translationTable) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *translationTable) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 5) + t.fieldMap["sourceTable"] = t.SourceTable + t.fieldMap["destinationTable"] = t.DestinationTable + t.fieldMap["translatedKey"] = t.TranslatedKey + t.fieldMap["tcGroupID"] = t.TcGroupID + t.fieldMap["tcID"] = t.TcID +} + +func (t translationTable) clone(db *gorm.DB) translationTable { + t.translationTableDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t translationTable) replaceDB(db *gorm.DB) translationTable { + t.translationTableDo.ReplaceDB(db) + return t +} + +type translationTableDo struct{ gen.DO } + +func (t translationTableDo) Debug() *translationTableDo { + return t.withDO(t.DO.Debug()) +} + +func (t translationTableDo) WithContext(ctx context.Context) *translationTableDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t translationTableDo) ReadDB() *translationTableDo { + return t.Clauses(dbresolver.Read) +} + +func (t translationTableDo) WriteDB() *translationTableDo { + return t.Clauses(dbresolver.Write) +} + +func (t translationTableDo) Session(config *gorm.Session) *translationTableDo { + return t.withDO(t.DO.Session(config)) +} + +func (t translationTableDo) Clauses(conds ...clause.Expression) *translationTableDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t translationTableDo) Returning(value interface{}, columns ...string) *translationTableDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t translationTableDo) Not(conds ...gen.Condition) *translationTableDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t translationTableDo) Or(conds ...gen.Condition) *translationTableDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t translationTableDo) Select(conds ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t translationTableDo) Where(conds ...gen.Condition) *translationTableDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t translationTableDo) Order(conds ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t translationTableDo) Distinct(cols ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t translationTableDo) Omit(cols ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t translationTableDo) Join(table schema.Tabler, on ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t translationTableDo) LeftJoin(table schema.Tabler, on ...field.Expr) *translationTableDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t translationTableDo) RightJoin(table schema.Tabler, on ...field.Expr) *translationTableDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t translationTableDo) Group(cols ...field.Expr) *translationTableDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t translationTableDo) Having(conds ...gen.Condition) *translationTableDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t translationTableDo) Limit(limit int) *translationTableDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t translationTableDo) Offset(offset int) *translationTableDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t translationTableDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *translationTableDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t translationTableDo) Unscoped() *translationTableDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t translationTableDo) Create(values ...*models.TranslationTable) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t translationTableDo) CreateInBatches(values []*models.TranslationTable, batchSize int) error { + return t.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 (t translationTableDo) Save(values ...*models.TranslationTable) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t translationTableDo) First() (*models.TranslationTable, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.TranslationTable), nil + } +} + +func (t translationTableDo) Take() (*models.TranslationTable, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.TranslationTable), nil + } +} + +func (t translationTableDo) Last() (*models.TranslationTable, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.TranslationTable), nil + } +} + +func (t translationTableDo) Find() ([]*models.TranslationTable, error) { + result, err := t.DO.Find() + return result.([]*models.TranslationTable), err +} + +func (t translationTableDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.TranslationTable, err error) { + buf := make([]*models.TranslationTable, 0, batchSize) + err = t.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 (t translationTableDo) FindInBatches(result *[]*models.TranslationTable, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t translationTableDo) Attrs(attrs ...field.AssignExpr) *translationTableDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t translationTableDo) Assign(attrs ...field.AssignExpr) *translationTableDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t translationTableDo) Joins(fields ...field.RelationField) *translationTableDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t translationTableDo) Preload(fields ...field.RelationField) *translationTableDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t translationTableDo) FirstOrInit() (*models.TranslationTable, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.TranslationTable), nil + } +} + +func (t translationTableDo) FirstOrCreate() (*models.TranslationTable, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.TranslationTable), nil + } +} + +func (t translationTableDo) FindByPage(offset int, limit int) (result []*models.TranslationTable, count int64, err error) { + result, err = t.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 = t.Offset(-1).Limit(-1).Count() + return +} + +func (t translationTableDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t translationTableDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t translationTableDo) Delete(models ...*models.TranslationTable) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *translationTableDo) withDO(do gen.Dao) *translationTableDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/models/trntranslationcolumns.gen.go b/models/trntranslationcolumns.gen.go new file mode 100644 index 0000000..fb8cf56 --- /dev/null +++ b/models/trntranslationcolumns.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newTrnTranslationColumn(db *gorm.DB, opts ...gen.DOOption) trnTranslationColumn { + _trnTranslationColumn := trnTranslationColumn{} + + _trnTranslationColumn.trnTranslationColumnDo.UseDB(db, opts...) + _trnTranslationColumn.trnTranslationColumnDo.UseModel(&models.TrnTranslationColumn{}) + + tableName := _trnTranslationColumn.trnTranslationColumnDo.TableName() + _trnTranslationColumn.ALL = field.NewAsterisk(tableName) + _trnTranslationColumn.TcGroupID = field.NewInt32(tableName, "tcGroupID") + _trnTranslationColumn.TcID = field.NewInt32(tableName, "tcID") + _trnTranslationColumn.TableName_ = field.NewString(tableName, "tableName") + _trnTranslationColumn.ColumnName = field.NewString(tableName, "columnName") + _trnTranslationColumn.MasterID = field.NewString(tableName, "masterID") + + _trnTranslationColumn.fillFieldMap() + + return _trnTranslationColumn +} + +type trnTranslationColumn struct { + trnTranslationColumnDo trnTranslationColumnDo + + ALL field.Asterisk + TcGroupID field.Int32 + TcID field.Int32 + TableName_ field.String + ColumnName field.String + MasterID field.String + + fieldMap map[string]field.Expr +} + +func (t trnTranslationColumn) Table(newTableName string) *trnTranslationColumn { + t.trnTranslationColumnDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t trnTranslationColumn) As(alias string) *trnTranslationColumn { + t.trnTranslationColumnDo.DO = *(t.trnTranslationColumnDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *trnTranslationColumn) updateTableName(table string) *trnTranslationColumn { + t.ALL = field.NewAsterisk(table) + t.TcGroupID = field.NewInt32(table, "tcGroupID") + t.TcID = field.NewInt32(table, "tcID") + t.TableName_ = field.NewString(table, "tableName") + t.ColumnName = field.NewString(table, "columnName") + t.MasterID = field.NewString(table, "masterID") + + t.fillFieldMap() + + return t +} + +func (t *trnTranslationColumn) WithContext(ctx context.Context) *trnTranslationColumnDo { + return t.trnTranslationColumnDo.WithContext(ctx) +} + +func (t trnTranslationColumn) TableName() string { return t.trnTranslationColumnDo.TableName() } + +func (t trnTranslationColumn) Alias() string { return t.trnTranslationColumnDo.Alias() } + +func (t trnTranslationColumn) Columns(cols ...field.Expr) gen.Columns { + return t.trnTranslationColumnDo.Columns(cols...) +} + +func (t *trnTranslationColumn) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *trnTranslationColumn) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 5) + t.fieldMap["tcGroupID"] = t.TcGroupID + t.fieldMap["tcID"] = t.TcID + t.fieldMap["tableName"] = t.TableName_ + t.fieldMap["columnName"] = t.ColumnName + t.fieldMap["masterID"] = t.MasterID +} + +func (t trnTranslationColumn) clone(db *gorm.DB) trnTranslationColumn { + t.trnTranslationColumnDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t trnTranslationColumn) replaceDB(db *gorm.DB) trnTranslationColumn { + t.trnTranslationColumnDo.ReplaceDB(db) + return t +} + +type trnTranslationColumnDo struct{ gen.DO } + +func (t trnTranslationColumnDo) Debug() *trnTranslationColumnDo { + return t.withDO(t.DO.Debug()) +} + +func (t trnTranslationColumnDo) WithContext(ctx context.Context) *trnTranslationColumnDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t trnTranslationColumnDo) ReadDB() *trnTranslationColumnDo { + return t.Clauses(dbresolver.Read) +} + +func (t trnTranslationColumnDo) WriteDB() *trnTranslationColumnDo { + return t.Clauses(dbresolver.Write) +} + +func (t trnTranslationColumnDo) Session(config *gorm.Session) *trnTranslationColumnDo { + return t.withDO(t.DO.Session(config)) +} + +func (t trnTranslationColumnDo) Clauses(conds ...clause.Expression) *trnTranslationColumnDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t trnTranslationColumnDo) Returning(value interface{}, columns ...string) *trnTranslationColumnDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t trnTranslationColumnDo) Not(conds ...gen.Condition) *trnTranslationColumnDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t trnTranslationColumnDo) Or(conds ...gen.Condition) *trnTranslationColumnDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t trnTranslationColumnDo) Select(conds ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t trnTranslationColumnDo) Where(conds ...gen.Condition) *trnTranslationColumnDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t trnTranslationColumnDo) Order(conds ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t trnTranslationColumnDo) Distinct(cols ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t trnTranslationColumnDo) Omit(cols ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t trnTranslationColumnDo) Join(table schema.Tabler, on ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t trnTranslationColumnDo) LeftJoin(table schema.Tabler, on ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t trnTranslationColumnDo) RightJoin(table schema.Tabler, on ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t trnTranslationColumnDo) Group(cols ...field.Expr) *trnTranslationColumnDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t trnTranslationColumnDo) Having(conds ...gen.Condition) *trnTranslationColumnDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t trnTranslationColumnDo) Limit(limit int) *trnTranslationColumnDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t trnTranslationColumnDo) Offset(offset int) *trnTranslationColumnDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t trnTranslationColumnDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *trnTranslationColumnDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t trnTranslationColumnDo) Unscoped() *trnTranslationColumnDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t trnTranslationColumnDo) Create(values ...*models.TrnTranslationColumn) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t trnTranslationColumnDo) CreateInBatches(values []*models.TrnTranslationColumn, batchSize int) error { + return t.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 (t trnTranslationColumnDo) Save(values ...*models.TrnTranslationColumn) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t trnTranslationColumnDo) First() (*models.TrnTranslationColumn, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationColumn), nil + } +} + +func (t trnTranslationColumnDo) Take() (*models.TrnTranslationColumn, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationColumn), nil + } +} + +func (t trnTranslationColumnDo) Last() (*models.TrnTranslationColumn, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationColumn), nil + } +} + +func (t trnTranslationColumnDo) Find() ([]*models.TrnTranslationColumn, error) { + result, err := t.DO.Find() + return result.([]*models.TrnTranslationColumn), err +} + +func (t trnTranslationColumnDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.TrnTranslationColumn, err error) { + buf := make([]*models.TrnTranslationColumn, 0, batchSize) + err = t.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 (t trnTranslationColumnDo) FindInBatches(result *[]*models.TrnTranslationColumn, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t trnTranslationColumnDo) Attrs(attrs ...field.AssignExpr) *trnTranslationColumnDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t trnTranslationColumnDo) Assign(attrs ...field.AssignExpr) *trnTranslationColumnDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t trnTranslationColumnDo) Joins(fields ...field.RelationField) *trnTranslationColumnDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t trnTranslationColumnDo) Preload(fields ...field.RelationField) *trnTranslationColumnDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t trnTranslationColumnDo) FirstOrInit() (*models.TrnTranslationColumn, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationColumn), nil + } +} + +func (t trnTranslationColumnDo) FirstOrCreate() (*models.TrnTranslationColumn, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationColumn), nil + } +} + +func (t trnTranslationColumnDo) FindByPage(offset int, limit int) (result []*models.TrnTranslationColumn, count int64, err error) { + result, err = t.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 = t.Offset(-1).Limit(-1).Count() + return +} + +func (t trnTranslationColumnDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t trnTranslationColumnDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t trnTranslationColumnDo) Delete(models ...*models.TrnTranslationColumn) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *trnTranslationColumnDo) withDO(do gen.Dao) *trnTranslationColumnDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/models/trntranslationlanguages.gen.go b/models/trntranslationlanguages.gen.go new file mode 100644 index 0000000..57b2481 --- /dev/null +++ b/models/trntranslationlanguages.gen.go @@ -0,0 +1,339 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newTrnTranslationLanguage(db *gorm.DB, opts ...gen.DOOption) trnTranslationLanguage { + _trnTranslationLanguage := trnTranslationLanguage{} + + _trnTranslationLanguage.trnTranslationLanguageDo.UseDB(db, opts...) + _trnTranslationLanguage.trnTranslationLanguageDo.UseModel(&models.TrnTranslationLanguage{}) + + tableName := _trnTranslationLanguage.trnTranslationLanguageDo.TableName() + _trnTranslationLanguage.ALL = field.NewAsterisk(tableName) + _trnTranslationLanguage.NumericLanguageID = field.NewInt32(tableName, "numericLanguageID") + _trnTranslationLanguage.LanguageID = field.NewString(tableName, "languageID") + _trnTranslationLanguage.LanguageName = field.NewString(tableName, "languageName") + + _trnTranslationLanguage.fillFieldMap() + + return _trnTranslationLanguage +} + +type trnTranslationLanguage struct { + trnTranslationLanguageDo trnTranslationLanguageDo + + ALL field.Asterisk + NumericLanguageID field.Int32 + LanguageID field.String + LanguageName field.String + + fieldMap map[string]field.Expr +} + +func (t trnTranslationLanguage) Table(newTableName string) *trnTranslationLanguage { + t.trnTranslationLanguageDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t trnTranslationLanguage) As(alias string) *trnTranslationLanguage { + t.trnTranslationLanguageDo.DO = *(t.trnTranslationLanguageDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *trnTranslationLanguage) updateTableName(table string) *trnTranslationLanguage { + t.ALL = field.NewAsterisk(table) + t.NumericLanguageID = field.NewInt32(table, "numericLanguageID") + t.LanguageID = field.NewString(table, "languageID") + t.LanguageName = field.NewString(table, "languageName") + + t.fillFieldMap() + + return t +} + +func (t *trnTranslationLanguage) WithContext(ctx context.Context) *trnTranslationLanguageDo { + return t.trnTranslationLanguageDo.WithContext(ctx) +} + +func (t trnTranslationLanguage) TableName() string { return t.trnTranslationLanguageDo.TableName() } + +func (t trnTranslationLanguage) Alias() string { return t.trnTranslationLanguageDo.Alias() } + +func (t trnTranslationLanguage) Columns(cols ...field.Expr) gen.Columns { + return t.trnTranslationLanguageDo.Columns(cols...) +} + +func (t *trnTranslationLanguage) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *trnTranslationLanguage) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 3) + t.fieldMap["numericLanguageID"] = t.NumericLanguageID + t.fieldMap["languageID"] = t.LanguageID + t.fieldMap["languageName"] = t.LanguageName +} + +func (t trnTranslationLanguage) clone(db *gorm.DB) trnTranslationLanguage { + t.trnTranslationLanguageDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t trnTranslationLanguage) replaceDB(db *gorm.DB) trnTranslationLanguage { + t.trnTranslationLanguageDo.ReplaceDB(db) + return t +} + +type trnTranslationLanguageDo struct{ gen.DO } + +func (t trnTranslationLanguageDo) Debug() *trnTranslationLanguageDo { + return t.withDO(t.DO.Debug()) +} + +func (t trnTranslationLanguageDo) WithContext(ctx context.Context) *trnTranslationLanguageDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t trnTranslationLanguageDo) ReadDB() *trnTranslationLanguageDo { + return t.Clauses(dbresolver.Read) +} + +func (t trnTranslationLanguageDo) WriteDB() *trnTranslationLanguageDo { + return t.Clauses(dbresolver.Write) +} + +func (t trnTranslationLanguageDo) Session(config *gorm.Session) *trnTranslationLanguageDo { + return t.withDO(t.DO.Session(config)) +} + +func (t trnTranslationLanguageDo) Clauses(conds ...clause.Expression) *trnTranslationLanguageDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t trnTranslationLanguageDo) Returning(value interface{}, columns ...string) *trnTranslationLanguageDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t trnTranslationLanguageDo) Not(conds ...gen.Condition) *trnTranslationLanguageDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t trnTranslationLanguageDo) Or(conds ...gen.Condition) *trnTranslationLanguageDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t trnTranslationLanguageDo) Select(conds ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t trnTranslationLanguageDo) Where(conds ...gen.Condition) *trnTranslationLanguageDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t trnTranslationLanguageDo) Order(conds ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t trnTranslationLanguageDo) Distinct(cols ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t trnTranslationLanguageDo) Omit(cols ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t trnTranslationLanguageDo) Join(table schema.Tabler, on ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t trnTranslationLanguageDo) LeftJoin(table schema.Tabler, on ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t trnTranslationLanguageDo) RightJoin(table schema.Tabler, on ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t trnTranslationLanguageDo) Group(cols ...field.Expr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t trnTranslationLanguageDo) Having(conds ...gen.Condition) *trnTranslationLanguageDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t trnTranslationLanguageDo) Limit(limit int) *trnTranslationLanguageDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t trnTranslationLanguageDo) Offset(offset int) *trnTranslationLanguageDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t trnTranslationLanguageDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *trnTranslationLanguageDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t trnTranslationLanguageDo) Unscoped() *trnTranslationLanguageDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t trnTranslationLanguageDo) Create(values ...*models.TrnTranslationLanguage) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t trnTranslationLanguageDo) CreateInBatches(values []*models.TrnTranslationLanguage, batchSize int) error { + return t.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 (t trnTranslationLanguageDo) Save(values ...*models.TrnTranslationLanguage) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t trnTranslationLanguageDo) First() (*models.TrnTranslationLanguage, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationLanguage), nil + } +} + +func (t trnTranslationLanguageDo) Take() (*models.TrnTranslationLanguage, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationLanguage), nil + } +} + +func (t trnTranslationLanguageDo) Last() (*models.TrnTranslationLanguage, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationLanguage), nil + } +} + +func (t trnTranslationLanguageDo) Find() ([]*models.TrnTranslationLanguage, error) { + result, err := t.DO.Find() + return result.([]*models.TrnTranslationLanguage), err +} + +func (t trnTranslationLanguageDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.TrnTranslationLanguage, err error) { + buf := make([]*models.TrnTranslationLanguage, 0, batchSize) + err = t.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 (t trnTranslationLanguageDo) FindInBatches(result *[]*models.TrnTranslationLanguage, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t trnTranslationLanguageDo) Attrs(attrs ...field.AssignExpr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t trnTranslationLanguageDo) Assign(attrs ...field.AssignExpr) *trnTranslationLanguageDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t trnTranslationLanguageDo) Joins(fields ...field.RelationField) *trnTranslationLanguageDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t trnTranslationLanguageDo) Preload(fields ...field.RelationField) *trnTranslationLanguageDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t trnTranslationLanguageDo) FirstOrInit() (*models.TrnTranslationLanguage, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationLanguage), nil + } +} + +func (t trnTranslationLanguageDo) FirstOrCreate() (*models.TrnTranslationLanguage, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslationLanguage), nil + } +} + +func (t trnTranslationLanguageDo) FindByPage(offset int, limit int) (result []*models.TrnTranslationLanguage, count int64, err error) { + result, err = t.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 = t.Offset(-1).Limit(-1).Count() + return +} + +func (t trnTranslationLanguageDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t trnTranslationLanguageDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t trnTranslationLanguageDo) Delete(models ...*models.TrnTranslationLanguage) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *trnTranslationLanguageDo) withDO(do gen.Dao) *trnTranslationLanguageDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/models/trntranslations.gen.go b/models/trntranslations.gen.go new file mode 100644 index 0000000..61a2f4a --- /dev/null +++ b/models/trntranslations.gen.go @@ -0,0 +1,343 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newTrnTranslation(db *gorm.DB, opts ...gen.DOOption) trnTranslation { + _trnTranslation := trnTranslation{} + + _trnTranslation.trnTranslationDo.UseDB(db, opts...) + _trnTranslation.trnTranslationDo.UseModel(&models.TrnTranslation{}) + + tableName := _trnTranslation.trnTranslationDo.TableName() + _trnTranslation.ALL = field.NewAsterisk(tableName) + _trnTranslation.TcID = field.NewInt32(tableName, "tcID") + _trnTranslation.KeyID = field.NewInt32(tableName, "keyID") + _trnTranslation.LanguageID = field.NewString(tableName, "languageID") + _trnTranslation.Text = field.NewString(tableName, "text") + + _trnTranslation.fillFieldMap() + + return _trnTranslation +} + +type trnTranslation struct { + trnTranslationDo trnTranslationDo + + ALL field.Asterisk + TcID field.Int32 + KeyID field.Int32 + LanguageID field.String + Text field.String + + fieldMap map[string]field.Expr +} + +func (t trnTranslation) Table(newTableName string) *trnTranslation { + t.trnTranslationDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t trnTranslation) As(alias string) *trnTranslation { + t.trnTranslationDo.DO = *(t.trnTranslationDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *trnTranslation) updateTableName(table string) *trnTranslation { + t.ALL = field.NewAsterisk(table) + t.TcID = field.NewInt32(table, "tcID") + t.KeyID = field.NewInt32(table, "keyID") + t.LanguageID = field.NewString(table, "languageID") + t.Text = field.NewString(table, "text") + + t.fillFieldMap() + + return t +} + +func (t *trnTranslation) WithContext(ctx context.Context) *trnTranslationDo { + return t.trnTranslationDo.WithContext(ctx) +} + +func (t trnTranslation) TableName() string { return t.trnTranslationDo.TableName() } + +func (t trnTranslation) Alias() string { return t.trnTranslationDo.Alias() } + +func (t trnTranslation) Columns(cols ...field.Expr) gen.Columns { + return t.trnTranslationDo.Columns(cols...) +} + +func (t *trnTranslation) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *trnTranslation) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 4) + t.fieldMap["tcID"] = t.TcID + t.fieldMap["keyID"] = t.KeyID + t.fieldMap["languageID"] = t.LanguageID + t.fieldMap["text"] = t.Text +} + +func (t trnTranslation) clone(db *gorm.DB) trnTranslation { + t.trnTranslationDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t trnTranslation) replaceDB(db *gorm.DB) trnTranslation { + t.trnTranslationDo.ReplaceDB(db) + return t +} + +type trnTranslationDo struct{ gen.DO } + +func (t trnTranslationDo) Debug() *trnTranslationDo { + return t.withDO(t.DO.Debug()) +} + +func (t trnTranslationDo) WithContext(ctx context.Context) *trnTranslationDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t trnTranslationDo) ReadDB() *trnTranslationDo { + return t.Clauses(dbresolver.Read) +} + +func (t trnTranslationDo) WriteDB() *trnTranslationDo { + return t.Clauses(dbresolver.Write) +} + +func (t trnTranslationDo) Session(config *gorm.Session) *trnTranslationDo { + return t.withDO(t.DO.Session(config)) +} + +func (t trnTranslationDo) Clauses(conds ...clause.Expression) *trnTranslationDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t trnTranslationDo) Returning(value interface{}, columns ...string) *trnTranslationDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t trnTranslationDo) Not(conds ...gen.Condition) *trnTranslationDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t trnTranslationDo) Or(conds ...gen.Condition) *trnTranslationDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t trnTranslationDo) Select(conds ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t trnTranslationDo) Where(conds ...gen.Condition) *trnTranslationDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t trnTranslationDo) Order(conds ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t trnTranslationDo) Distinct(cols ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t trnTranslationDo) Omit(cols ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t trnTranslationDo) Join(table schema.Tabler, on ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t trnTranslationDo) LeftJoin(table schema.Tabler, on ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t trnTranslationDo) RightJoin(table schema.Tabler, on ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t trnTranslationDo) Group(cols ...field.Expr) *trnTranslationDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t trnTranslationDo) Having(conds ...gen.Condition) *trnTranslationDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t trnTranslationDo) Limit(limit int) *trnTranslationDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t trnTranslationDo) Offset(offset int) *trnTranslationDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t trnTranslationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *trnTranslationDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t trnTranslationDo) Unscoped() *trnTranslationDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t trnTranslationDo) Create(values ...*models.TrnTranslation) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t trnTranslationDo) CreateInBatches(values []*models.TrnTranslation, batchSize int) error { + return t.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 (t trnTranslationDo) Save(values ...*models.TrnTranslation) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t trnTranslationDo) First() (*models.TrnTranslation, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslation), nil + } +} + +func (t trnTranslationDo) Take() (*models.TrnTranslation, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslation), nil + } +} + +func (t trnTranslationDo) Last() (*models.TrnTranslation, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslation), nil + } +} + +func (t trnTranslationDo) Find() ([]*models.TrnTranslation, error) { + result, err := t.DO.Find() + return result.([]*models.TrnTranslation), err +} + +func (t trnTranslationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.TrnTranslation, err error) { + buf := make([]*models.TrnTranslation, 0, batchSize) + err = t.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 (t trnTranslationDo) FindInBatches(result *[]*models.TrnTranslation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t trnTranslationDo) Attrs(attrs ...field.AssignExpr) *trnTranslationDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t trnTranslationDo) Assign(attrs ...field.AssignExpr) *trnTranslationDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t trnTranslationDo) Joins(fields ...field.RelationField) *trnTranslationDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t trnTranslationDo) Preload(fields ...field.RelationField) *trnTranslationDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t trnTranslationDo) FirstOrInit() (*models.TrnTranslation, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslation), nil + } +} + +func (t trnTranslationDo) FirstOrCreate() (*models.TrnTranslation, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.TrnTranslation), nil + } +} + +func (t trnTranslationDo) FindByPage(offset int, limit int) (result []*models.TrnTranslation, count int64, err error) { + result, err = t.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 = t.Offset(-1).Limit(-1).Count() + return +} + +func (t trnTranslationDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t trnTranslationDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t trnTranslationDo) Delete(models ...*models.TrnTranslation) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *trnTranslationDo) withDO(do gen.Dao) *trnTranslationDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/models/warcombatzones.gen.go b/models/warcombatzones.gen.go new file mode 100644 index 0000000..cf1d0e0 --- /dev/null +++ b/models/warcombatzones.gen.go @@ -0,0 +1,347 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newWarCombatZone(db *gorm.DB, opts ...gen.DOOption) warCombatZone { + _warCombatZone := warCombatZone{} + + _warCombatZone.warCombatZoneDo.UseDB(db, opts...) + _warCombatZone.warCombatZoneDo.UseModel(&models.WarCombatZone{}) + + tableName := _warCombatZone.warCombatZoneDo.TableName() + _warCombatZone.ALL = field.NewAsterisk(tableName) + _warCombatZone.CombatZoneID = field.NewInt32(tableName, "combatZoneID") + _warCombatZone.CombatZoneName = field.NewString(tableName, "combatZoneName") + _warCombatZone.FactionID = field.NewInt32(tableName, "factionID") + _warCombatZone.CenterSystemID = field.NewInt32(tableName, "centerSystemID") + _warCombatZone.Description = field.NewString(tableName, "description") + + _warCombatZone.fillFieldMap() + + return _warCombatZone +} + +type warCombatZone struct { + warCombatZoneDo warCombatZoneDo + + ALL field.Asterisk + CombatZoneID field.Int32 + CombatZoneName field.String + FactionID field.Int32 + CenterSystemID field.Int32 + Description field.String + + fieldMap map[string]field.Expr +} + +func (w warCombatZone) Table(newTableName string) *warCombatZone { + w.warCombatZoneDo.UseTable(newTableName) + return w.updateTableName(newTableName) +} + +func (w warCombatZone) As(alias string) *warCombatZone { + w.warCombatZoneDo.DO = *(w.warCombatZoneDo.As(alias).(*gen.DO)) + return w.updateTableName(alias) +} + +func (w *warCombatZone) updateTableName(table string) *warCombatZone { + w.ALL = field.NewAsterisk(table) + w.CombatZoneID = field.NewInt32(table, "combatZoneID") + w.CombatZoneName = field.NewString(table, "combatZoneName") + w.FactionID = field.NewInt32(table, "factionID") + w.CenterSystemID = field.NewInt32(table, "centerSystemID") + w.Description = field.NewString(table, "description") + + w.fillFieldMap() + + return w +} + +func (w *warCombatZone) WithContext(ctx context.Context) *warCombatZoneDo { + return w.warCombatZoneDo.WithContext(ctx) +} + +func (w warCombatZone) TableName() string { return w.warCombatZoneDo.TableName() } + +func (w warCombatZone) Alias() string { return w.warCombatZoneDo.Alias() } + +func (w warCombatZone) Columns(cols ...field.Expr) gen.Columns { + return w.warCombatZoneDo.Columns(cols...) +} + +func (w *warCombatZone) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := w.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (w *warCombatZone) fillFieldMap() { + w.fieldMap = make(map[string]field.Expr, 5) + w.fieldMap["combatZoneID"] = w.CombatZoneID + w.fieldMap["combatZoneName"] = w.CombatZoneName + w.fieldMap["factionID"] = w.FactionID + w.fieldMap["centerSystemID"] = w.CenterSystemID + w.fieldMap["description"] = w.Description +} + +func (w warCombatZone) clone(db *gorm.DB) warCombatZone { + w.warCombatZoneDo.ReplaceConnPool(db.Statement.ConnPool) + return w +} + +func (w warCombatZone) replaceDB(db *gorm.DB) warCombatZone { + w.warCombatZoneDo.ReplaceDB(db) + return w +} + +type warCombatZoneDo struct{ gen.DO } + +func (w warCombatZoneDo) Debug() *warCombatZoneDo { + return w.withDO(w.DO.Debug()) +} + +func (w warCombatZoneDo) WithContext(ctx context.Context) *warCombatZoneDo { + return w.withDO(w.DO.WithContext(ctx)) +} + +func (w warCombatZoneDo) ReadDB() *warCombatZoneDo { + return w.Clauses(dbresolver.Read) +} + +func (w warCombatZoneDo) WriteDB() *warCombatZoneDo { + return w.Clauses(dbresolver.Write) +} + +func (w warCombatZoneDo) Session(config *gorm.Session) *warCombatZoneDo { + return w.withDO(w.DO.Session(config)) +} + +func (w warCombatZoneDo) Clauses(conds ...clause.Expression) *warCombatZoneDo { + return w.withDO(w.DO.Clauses(conds...)) +} + +func (w warCombatZoneDo) Returning(value interface{}, columns ...string) *warCombatZoneDo { + return w.withDO(w.DO.Returning(value, columns...)) +} + +func (w warCombatZoneDo) Not(conds ...gen.Condition) *warCombatZoneDo { + return w.withDO(w.DO.Not(conds...)) +} + +func (w warCombatZoneDo) Or(conds ...gen.Condition) *warCombatZoneDo { + return w.withDO(w.DO.Or(conds...)) +} + +func (w warCombatZoneDo) Select(conds ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Select(conds...)) +} + +func (w warCombatZoneDo) Where(conds ...gen.Condition) *warCombatZoneDo { + return w.withDO(w.DO.Where(conds...)) +} + +func (w warCombatZoneDo) Order(conds ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Order(conds...)) +} + +func (w warCombatZoneDo) Distinct(cols ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Distinct(cols...)) +} + +func (w warCombatZoneDo) Omit(cols ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Omit(cols...)) +} + +func (w warCombatZoneDo) Join(table schema.Tabler, on ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Join(table, on...)) +} + +func (w warCombatZoneDo) LeftJoin(table schema.Tabler, on ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.LeftJoin(table, on...)) +} + +func (w warCombatZoneDo) RightJoin(table schema.Tabler, on ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.RightJoin(table, on...)) +} + +func (w warCombatZoneDo) Group(cols ...field.Expr) *warCombatZoneDo { + return w.withDO(w.DO.Group(cols...)) +} + +func (w warCombatZoneDo) Having(conds ...gen.Condition) *warCombatZoneDo { + return w.withDO(w.DO.Having(conds...)) +} + +func (w warCombatZoneDo) Limit(limit int) *warCombatZoneDo { + return w.withDO(w.DO.Limit(limit)) +} + +func (w warCombatZoneDo) Offset(offset int) *warCombatZoneDo { + return w.withDO(w.DO.Offset(offset)) +} + +func (w warCombatZoneDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *warCombatZoneDo { + return w.withDO(w.DO.Scopes(funcs...)) +} + +func (w warCombatZoneDo) Unscoped() *warCombatZoneDo { + return w.withDO(w.DO.Unscoped()) +} + +func (w warCombatZoneDo) Create(values ...*models.WarCombatZone) error { + if len(values) == 0 { + return nil + } + return w.DO.Create(values) +} + +func (w warCombatZoneDo) CreateInBatches(values []*models.WarCombatZone, batchSize int) error { + return w.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 (w warCombatZoneDo) Save(values ...*models.WarCombatZone) error { + if len(values) == 0 { + return nil + } + return w.DO.Save(values) +} + +func (w warCombatZoneDo) First() (*models.WarCombatZone, error) { + if result, err := w.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZone), nil + } +} + +func (w warCombatZoneDo) Take() (*models.WarCombatZone, error) { + if result, err := w.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZone), nil + } +} + +func (w warCombatZoneDo) Last() (*models.WarCombatZone, error) { + if result, err := w.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZone), nil + } +} + +func (w warCombatZoneDo) Find() ([]*models.WarCombatZone, error) { + result, err := w.DO.Find() + return result.([]*models.WarCombatZone), err +} + +func (w warCombatZoneDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.WarCombatZone, err error) { + buf := make([]*models.WarCombatZone, 0, batchSize) + err = w.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 (w warCombatZoneDo) FindInBatches(result *[]*models.WarCombatZone, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return w.DO.FindInBatches(result, batchSize, fc) +} + +func (w warCombatZoneDo) Attrs(attrs ...field.AssignExpr) *warCombatZoneDo { + return w.withDO(w.DO.Attrs(attrs...)) +} + +func (w warCombatZoneDo) Assign(attrs ...field.AssignExpr) *warCombatZoneDo { + return w.withDO(w.DO.Assign(attrs...)) +} + +func (w warCombatZoneDo) Joins(fields ...field.RelationField) *warCombatZoneDo { + for _, _f := range fields { + w = *w.withDO(w.DO.Joins(_f)) + } + return &w +} + +func (w warCombatZoneDo) Preload(fields ...field.RelationField) *warCombatZoneDo { + for _, _f := range fields { + w = *w.withDO(w.DO.Preload(_f)) + } + return &w +} + +func (w warCombatZoneDo) FirstOrInit() (*models.WarCombatZone, error) { + if result, err := w.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZone), nil + } +} + +func (w warCombatZoneDo) FirstOrCreate() (*models.WarCombatZone, error) { + if result, err := w.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZone), nil + } +} + +func (w warCombatZoneDo) FindByPage(offset int, limit int) (result []*models.WarCombatZone, count int64, err error) { + result, err = w.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 = w.Offset(-1).Limit(-1).Count() + return +} + +func (w warCombatZoneDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = w.Count() + if err != nil { + return + } + + err = w.Offset(offset).Limit(limit).Scan(result) + return +} + +func (w warCombatZoneDo) Scan(result interface{}) (err error) { + return w.DO.Scan(result) +} + +func (w warCombatZoneDo) Delete(models ...*models.WarCombatZone) (result gen.ResultInfo, err error) { + return w.DO.Delete(models) +} + +func (w *warCombatZoneDo) withDO(do gen.Dao) *warCombatZoneDo { + w.DO = *do.(*gen.DO) + return w +} diff --git a/models/warcombatzonesystems.gen.go b/models/warcombatzonesystems.gen.go new file mode 100644 index 0000000..b7c9d30 --- /dev/null +++ b/models/warcombatzonesystems.gen.go @@ -0,0 +1,335 @@ +// 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 models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "zkillsusser/models" +) + +func newWarCombatZoneSystem(db *gorm.DB, opts ...gen.DOOption) warCombatZoneSystem { + _warCombatZoneSystem := warCombatZoneSystem{} + + _warCombatZoneSystem.warCombatZoneSystemDo.UseDB(db, opts...) + _warCombatZoneSystem.warCombatZoneSystemDo.UseModel(&models.WarCombatZoneSystem{}) + + tableName := _warCombatZoneSystem.warCombatZoneSystemDo.TableName() + _warCombatZoneSystem.ALL = field.NewAsterisk(tableName) + _warCombatZoneSystem.SolarSystemID = field.NewInt32(tableName, "solarSystemID") + _warCombatZoneSystem.CombatZoneID = field.NewInt32(tableName, "combatZoneID") + + _warCombatZoneSystem.fillFieldMap() + + return _warCombatZoneSystem +} + +type warCombatZoneSystem struct { + warCombatZoneSystemDo warCombatZoneSystemDo + + ALL field.Asterisk + SolarSystemID field.Int32 + CombatZoneID field.Int32 + + fieldMap map[string]field.Expr +} + +func (w warCombatZoneSystem) Table(newTableName string) *warCombatZoneSystem { + w.warCombatZoneSystemDo.UseTable(newTableName) + return w.updateTableName(newTableName) +} + +func (w warCombatZoneSystem) As(alias string) *warCombatZoneSystem { + w.warCombatZoneSystemDo.DO = *(w.warCombatZoneSystemDo.As(alias).(*gen.DO)) + return w.updateTableName(alias) +} + +func (w *warCombatZoneSystem) updateTableName(table string) *warCombatZoneSystem { + w.ALL = field.NewAsterisk(table) + w.SolarSystemID = field.NewInt32(table, "solarSystemID") + w.CombatZoneID = field.NewInt32(table, "combatZoneID") + + w.fillFieldMap() + + return w +} + +func (w *warCombatZoneSystem) WithContext(ctx context.Context) *warCombatZoneSystemDo { + return w.warCombatZoneSystemDo.WithContext(ctx) +} + +func (w warCombatZoneSystem) TableName() string { return w.warCombatZoneSystemDo.TableName() } + +func (w warCombatZoneSystem) Alias() string { return w.warCombatZoneSystemDo.Alias() } + +func (w warCombatZoneSystem) Columns(cols ...field.Expr) gen.Columns { + return w.warCombatZoneSystemDo.Columns(cols...) +} + +func (w *warCombatZoneSystem) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := w.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (w *warCombatZoneSystem) fillFieldMap() { + w.fieldMap = make(map[string]field.Expr, 2) + w.fieldMap["solarSystemID"] = w.SolarSystemID + w.fieldMap["combatZoneID"] = w.CombatZoneID +} + +func (w warCombatZoneSystem) clone(db *gorm.DB) warCombatZoneSystem { + w.warCombatZoneSystemDo.ReplaceConnPool(db.Statement.ConnPool) + return w +} + +func (w warCombatZoneSystem) replaceDB(db *gorm.DB) warCombatZoneSystem { + w.warCombatZoneSystemDo.ReplaceDB(db) + return w +} + +type warCombatZoneSystemDo struct{ gen.DO } + +func (w warCombatZoneSystemDo) Debug() *warCombatZoneSystemDo { + return w.withDO(w.DO.Debug()) +} + +func (w warCombatZoneSystemDo) WithContext(ctx context.Context) *warCombatZoneSystemDo { + return w.withDO(w.DO.WithContext(ctx)) +} + +func (w warCombatZoneSystemDo) ReadDB() *warCombatZoneSystemDo { + return w.Clauses(dbresolver.Read) +} + +func (w warCombatZoneSystemDo) WriteDB() *warCombatZoneSystemDo { + return w.Clauses(dbresolver.Write) +} + +func (w warCombatZoneSystemDo) Session(config *gorm.Session) *warCombatZoneSystemDo { + return w.withDO(w.DO.Session(config)) +} + +func (w warCombatZoneSystemDo) Clauses(conds ...clause.Expression) *warCombatZoneSystemDo { + return w.withDO(w.DO.Clauses(conds...)) +} + +func (w warCombatZoneSystemDo) Returning(value interface{}, columns ...string) *warCombatZoneSystemDo { + return w.withDO(w.DO.Returning(value, columns...)) +} + +func (w warCombatZoneSystemDo) Not(conds ...gen.Condition) *warCombatZoneSystemDo { + return w.withDO(w.DO.Not(conds...)) +} + +func (w warCombatZoneSystemDo) Or(conds ...gen.Condition) *warCombatZoneSystemDo { + return w.withDO(w.DO.Or(conds...)) +} + +func (w warCombatZoneSystemDo) Select(conds ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Select(conds...)) +} + +func (w warCombatZoneSystemDo) Where(conds ...gen.Condition) *warCombatZoneSystemDo { + return w.withDO(w.DO.Where(conds...)) +} + +func (w warCombatZoneSystemDo) Order(conds ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Order(conds...)) +} + +func (w warCombatZoneSystemDo) Distinct(cols ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Distinct(cols...)) +} + +func (w warCombatZoneSystemDo) Omit(cols ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Omit(cols...)) +} + +func (w warCombatZoneSystemDo) Join(table schema.Tabler, on ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Join(table, on...)) +} + +func (w warCombatZoneSystemDo) LeftJoin(table schema.Tabler, on ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.LeftJoin(table, on...)) +} + +func (w warCombatZoneSystemDo) RightJoin(table schema.Tabler, on ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.RightJoin(table, on...)) +} + +func (w warCombatZoneSystemDo) Group(cols ...field.Expr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Group(cols...)) +} + +func (w warCombatZoneSystemDo) Having(conds ...gen.Condition) *warCombatZoneSystemDo { + return w.withDO(w.DO.Having(conds...)) +} + +func (w warCombatZoneSystemDo) Limit(limit int) *warCombatZoneSystemDo { + return w.withDO(w.DO.Limit(limit)) +} + +func (w warCombatZoneSystemDo) Offset(offset int) *warCombatZoneSystemDo { + return w.withDO(w.DO.Offset(offset)) +} + +func (w warCombatZoneSystemDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *warCombatZoneSystemDo { + return w.withDO(w.DO.Scopes(funcs...)) +} + +func (w warCombatZoneSystemDo) Unscoped() *warCombatZoneSystemDo { + return w.withDO(w.DO.Unscoped()) +} + +func (w warCombatZoneSystemDo) Create(values ...*models.WarCombatZoneSystem) error { + if len(values) == 0 { + return nil + } + return w.DO.Create(values) +} + +func (w warCombatZoneSystemDo) CreateInBatches(values []*models.WarCombatZoneSystem, batchSize int) error { + return w.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 (w warCombatZoneSystemDo) Save(values ...*models.WarCombatZoneSystem) error { + if len(values) == 0 { + return nil + } + return w.DO.Save(values) +} + +func (w warCombatZoneSystemDo) First() (*models.WarCombatZoneSystem, error) { + if result, err := w.DO.First(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZoneSystem), nil + } +} + +func (w warCombatZoneSystemDo) Take() (*models.WarCombatZoneSystem, error) { + if result, err := w.DO.Take(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZoneSystem), nil + } +} + +func (w warCombatZoneSystemDo) Last() (*models.WarCombatZoneSystem, error) { + if result, err := w.DO.Last(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZoneSystem), nil + } +} + +func (w warCombatZoneSystemDo) Find() ([]*models.WarCombatZoneSystem, error) { + result, err := w.DO.Find() + return result.([]*models.WarCombatZoneSystem), err +} + +func (w warCombatZoneSystemDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.WarCombatZoneSystem, err error) { + buf := make([]*models.WarCombatZoneSystem, 0, batchSize) + err = w.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 (w warCombatZoneSystemDo) FindInBatches(result *[]*models.WarCombatZoneSystem, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return w.DO.FindInBatches(result, batchSize, fc) +} + +func (w warCombatZoneSystemDo) Attrs(attrs ...field.AssignExpr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Attrs(attrs...)) +} + +func (w warCombatZoneSystemDo) Assign(attrs ...field.AssignExpr) *warCombatZoneSystemDo { + return w.withDO(w.DO.Assign(attrs...)) +} + +func (w warCombatZoneSystemDo) Joins(fields ...field.RelationField) *warCombatZoneSystemDo { + for _, _f := range fields { + w = *w.withDO(w.DO.Joins(_f)) + } + return &w +} + +func (w warCombatZoneSystemDo) Preload(fields ...field.RelationField) *warCombatZoneSystemDo { + for _, _f := range fields { + w = *w.withDO(w.DO.Preload(_f)) + } + return &w +} + +func (w warCombatZoneSystemDo) FirstOrInit() (*models.WarCombatZoneSystem, error) { + if result, err := w.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZoneSystem), nil + } +} + +func (w warCombatZoneSystemDo) FirstOrCreate() (*models.WarCombatZoneSystem, error) { + if result, err := w.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*models.WarCombatZoneSystem), nil + } +} + +func (w warCombatZoneSystemDo) FindByPage(offset int, limit int) (result []*models.WarCombatZoneSystem, count int64, err error) { + result, err = w.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 = w.Offset(-1).Limit(-1).Count() + return +} + +func (w warCombatZoneSystemDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = w.Count() + if err != nil { + return + } + + err = w.Offset(offset).Limit(limit).Scan(result) + return +} + +func (w warCombatZoneSystemDo) Scan(result interface{}) (err error) { + return w.DO.Scan(result) +} + +func (w warCombatZoneSystemDo) Delete(models ...*models.WarCombatZoneSystem) (result gen.ResultInfo, err error) { + return w.DO.Delete(models) +} + +func (w *warCombatZoneSystemDo) withDO(do gen.Dao) *warCombatZoneSystemDo { + w.DO = *do.(*gen.DO) + return w +}