// Code generated by BobGen psql v0.41.1. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" "testing" "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" ) type FSContainerrelateMod interface { Apply(context.Context, *FSContainerrelateTemplate) } type FSContainerrelateModFunc func(context.Context, *FSContainerrelateTemplate) func (f FSContainerrelateModFunc) Apply(ctx context.Context, n *FSContainerrelateTemplate) { f(ctx, n) } type FSContainerrelateModSlice []FSContainerrelateMod func (mods FSContainerrelateModSlice) Apply(ctx context.Context, n *FSContainerrelateTemplate) { for _, f := range mods { f.Apply(ctx, n) } } // FSContainerrelateTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSContainerrelateTemplate struct { OrganizationID func() int32 Containertype func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] Editor func() null.Val[string] Globalid func() null.Val[string] Inspsampleid func() null.Val[string] Mosquitoinspid func() null.Val[string] Objectid func() int32 Treatmentid func() null.Val[string] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] GeometryY func() null.Val[float64] LastEditedDate func() null.Val[int64] LastEditedUser func() null.Val[string] Updated func() time.Time r fsContainerrelateR f *Factory alreadyPersisted bool } type fsContainerrelateR struct { Organization *fsContainerrelateROrganizationR } type fsContainerrelateROrganizationR struct { o *OrganizationTemplate } // Apply mods to the FSContainerrelateTemplate func (o *FSContainerrelateTemplate) Apply(ctx context.Context, mods ...FSContainerrelateMod) { for _, mod := range mods { mod.Apply(ctx, o) } } // setModelRels creates and sets the relationships on *models.FSContainerrelate // according to the relationships in the template. Nothing is inserted into the db func (t FSContainerrelateTemplate) setModelRels(o *models.FSContainerrelate) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSContainerrelates = append(rel.R.FSContainerrelates, o) o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } // BuildSetter returns an *models.FSContainerrelateSetter // this does nothing with the relationship templates func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter { m := &models.FSContainerrelateSetter{} if o.OrganizationID != nil { val := o.OrganizationID() m.OrganizationID = omit.From(val) } if o.Containertype != nil { val := o.Containertype() m.Containertype = omitnull.FromNull(val) } if o.Creationdate != nil { val := o.Creationdate() m.Creationdate = omitnull.FromNull(val) } if o.Creator != nil { val := o.Creator() m.Creator = omitnull.FromNull(val) } if o.Editdate != nil { val := o.Editdate() m.Editdate = omitnull.FromNull(val) } if o.Editor != nil { val := o.Editor() m.Editor = omitnull.FromNull(val) } if o.Globalid != nil { val := o.Globalid() m.Globalid = omitnull.FromNull(val) } if o.Inspsampleid != nil { val := o.Inspsampleid() m.Inspsampleid = omitnull.FromNull(val) } if o.Mosquitoinspid != nil { val := o.Mosquitoinspid() m.Mosquitoinspid = omitnull.FromNull(val) } if o.Objectid != nil { val := o.Objectid() m.Objectid = omit.From(val) } if o.Treatmentid != nil { val := o.Treatmentid() m.Treatmentid = omitnull.FromNull(val) } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) } if o.CreatedUser != nil { val := o.CreatedUser() m.CreatedUser = omitnull.FromNull(val) } if o.GeometryX != nil { val := o.GeometryX() m.GeometryX = omitnull.FromNull(val) } if o.GeometryY != nil { val := o.GeometryY() m.GeometryY = omitnull.FromNull(val) } if o.LastEditedDate != nil { val := o.LastEditedDate() m.LastEditedDate = omitnull.FromNull(val) } if o.LastEditedUser != nil { val := o.LastEditedUser() m.LastEditedUser = omitnull.FromNull(val) } if o.Updated != nil { val := o.Updated() m.Updated = omit.From(val) } return m } // BuildManySetter returns an []*models.FSContainerrelateSetter // this does nothing with the relationship templates func (o FSContainerrelateTemplate) BuildManySetter(number int) []*models.FSContainerrelateSetter { m := make([]*models.FSContainerrelateSetter, number) for i := range m { m[i] = o.BuildSetter() } return m } // Build returns an *models.FSContainerrelate // Related objects are also created and placed in the .R field // NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.Create func (o FSContainerrelateTemplate) Build() *models.FSContainerrelate { m := &models.FSContainerrelate{} if o.OrganizationID != nil { m.OrganizationID = o.OrganizationID() } if o.Containertype != nil { m.Containertype = o.Containertype() } if o.Creationdate != nil { m.Creationdate = o.Creationdate() } if o.Creator != nil { m.Creator = o.Creator() } if o.Editdate != nil { m.Editdate = o.Editdate() } if o.Editor != nil { m.Editor = o.Editor() } if o.Globalid != nil { m.Globalid = o.Globalid() } if o.Inspsampleid != nil { m.Inspsampleid = o.Inspsampleid() } if o.Mosquitoinspid != nil { m.Mosquitoinspid = o.Mosquitoinspid() } if o.Objectid != nil { m.Objectid = o.Objectid() } if o.Treatmentid != nil { m.Treatmentid = o.Treatmentid() } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } if o.CreatedUser != nil { m.CreatedUser = o.CreatedUser() } if o.GeometryX != nil { m.GeometryX = o.GeometryX() } if o.GeometryY != nil { m.GeometryY = o.GeometryY() } if o.LastEditedDate != nil { m.LastEditedDate = o.LastEditedDate() } if o.LastEditedUser != nil { m.LastEditedUser = o.LastEditedUser() } if o.Updated != nil { m.Updated = o.Updated() } o.setModelRels(m) return m } // BuildMany returns an models.FSContainerrelateSlice // Related objects are also created and placed in the .R field // NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.CreateMany func (o FSContainerrelateTemplate) BuildMany(number int) models.FSContainerrelateSlice { m := make(models.FSContainerrelateSlice, number) for i := range m { m[i] = o.Build() } return m } func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) { if !(m.OrganizationID.IsValue()) { val := random_int32(nil) m.OrganizationID = omit.From(val) } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) } } // insertOptRels creates and inserts any optional the relationships on *models.FSContainerrelate // according to the relationships in the template. // any required relationship should have already exist on the model func (o *FSContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSContainerrelate) error { var err error return err } // Create builds a fsContainerrelate and inserts it into the database // Relations objects are also inserted and placed in the .R field func (o *FSContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSContainerrelate, error) { var err error opt := o.BuildSetter() ensureCreatableFSContainerrelate(opt) if o.r.Organization == nil { FSContainerrelateMods.WithNewOrganization().Apply(ctx, o) } var rel0 *models.Organization if o.r.Organization.o.alreadyPersisted { rel0 = o.r.Organization.o.Build() } else { rel0, err = o.r.Organization.o.Create(ctx, exec) if err != nil { return nil, err } } opt.OrganizationID = omit.From(rel0.ID) m, err := models.FSContainerrelates.Insert(opt).One(ctx, exec) if err != nil { return nil, err } m.R.Organization = rel0 if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } return m, err } // MustCreate builds a fsContainerrelate and inserts it into the database // Relations objects are also inserted and placed in the .R field // panics if an error occurs func (o *FSContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSContainerrelate { m, err := o.Create(ctx, exec) if err != nil { panic(err) } return m } // CreateOrFail builds a fsContainerrelate and inserts it into the database // Relations objects are also inserted and placed in the .R field // It calls `tb.Fatal(err)` on the test/benchmark if an error occurs func (o *FSContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSContainerrelate { tb.Helper() m, err := o.Create(ctx, exec) if err != nil { tb.Fatal(err) return nil } return m } // CreateMany builds multiple fsContainerrelates and inserts them into the database // Relations objects are also inserted and placed in the .R field func (o FSContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSContainerrelateSlice, error) { var err error m := make(models.FSContainerrelateSlice, number) for i := range m { m[i], err = o.Create(ctx, exec) if err != nil { return nil, err } } return m, nil } // MustCreateMany builds multiple fsContainerrelates and inserts them into the database // Relations objects are also inserted and placed in the .R field // panics if an error occurs func (o FSContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSContainerrelateSlice { m, err := o.CreateMany(ctx, exec, number) if err != nil { panic(err) } return m } // CreateManyOrFail builds multiple fsContainerrelates and inserts them into the database // Relations objects are also inserted and placed in the .R field // It calls `tb.Fatal(err)` on the test/benchmark if an error occurs func (o FSContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSContainerrelateSlice { tb.Helper() m, err := o.CreateMany(ctx, exec, number) if err != nil { tb.Fatal(err) return nil } return m } // FSContainerrelate has methods that act as mods for the FSContainerrelateTemplate var FSContainerrelateMods fsContainerrelateMods type fsContainerrelateMods struct{} func (m fsContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModSlice{ FSContainerrelateMods.RandomOrganizationID(f), FSContainerrelateMods.RandomContainertype(f), FSContainerrelateMods.RandomCreationdate(f), FSContainerrelateMods.RandomCreator(f), FSContainerrelateMods.RandomEditdate(f), FSContainerrelateMods.RandomEditor(f), FSContainerrelateMods.RandomGlobalid(f), FSContainerrelateMods.RandomInspsampleid(f), FSContainerrelateMods.RandomMosquitoinspid(f), FSContainerrelateMods.RandomObjectid(f), FSContainerrelateMods.RandomTreatmentid(f), FSContainerrelateMods.RandomCreatedDate(f), FSContainerrelateMods.RandomCreatedUser(f), FSContainerrelateMods.RandomGeometryX(f), FSContainerrelateMods.RandomGeometryY(f), FSContainerrelateMods.RandomLastEditedDate(f), FSContainerrelateMods.RandomLastEditedUser(f), FSContainerrelateMods.RandomUpdated(f), } } // Set the model columns to this value func (m fsContainerrelateMods) OrganizationID(val int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) OrganizationIDFunc(f func() int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.OrganizationID = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetOrganizationID() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.OrganizationID = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used func (m fsContainerrelateMods) RandomOrganizationID(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.OrganizationID = func() int32 { return random_int32(f) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Containertype(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Containertype = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Containertype = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetContainertype() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Containertype = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomContainertype(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Containertype = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomContainertypeNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Containertype = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Creationdate(val null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creationdate = func() null.Val[int64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creationdate = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetCreationdate() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creationdate = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomCreationdate(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creationdate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomCreationdateNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creationdate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Creator(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creator = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) CreatorFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creator = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetCreator() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creator = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomCreator(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creator = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomCreatorNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Creator = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Editdate(val null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editdate = func() null.Val[int64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) EditdateFunc(f func() null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editdate = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetEditdate() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editdate = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomEditdate(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editdate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomEditdateNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editdate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Editor(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editor = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) EditorFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editor = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetEditor() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editor = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomEditor(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editor = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomEditorNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Editor = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Globalid(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Globalid = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) GlobalidFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Globalid = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetGlobalid() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Globalid = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomGlobalid(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Globalid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomGlobalidNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Globalid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Inspsampleid(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Inspsampleid = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Inspsampleid = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetInspsampleid() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Inspsampleid = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomInspsampleid(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Inspsampleid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomInspsampleidNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Inspsampleid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Mosquitoinspid(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Mosquitoinspid = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Mosquitoinspid = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetMosquitoinspid() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Mosquitoinspid = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Mosquitoinspid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomMosquitoinspidNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Mosquitoinspid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Objectid(val int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Objectid = func() int32 { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) ObjectidFunc(f func() int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Objectid = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetObjectid() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Objectid = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used func (m fsContainerrelateMods) RandomObjectid(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Objectid = func() int32 { return random_int32(f) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Treatmentid(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Treatmentid = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Treatmentid = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetTreatmentid() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Treatmentid = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomTreatmentid(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Treatmentid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Treatmentid = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) CreatedDate(val null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedDate = func() null.Val[int64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedDate = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetCreatedDate() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedDate = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomCreatedDate(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedDate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomCreatedDateNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedDate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) CreatedUser(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedUser = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedUser = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetCreatedUser() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedUser = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomCreatedUser(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedUser = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomCreatedUserNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.CreatedUser = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) GeometryX(val null.Val[float64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryX = func() null.Val[float64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryX = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetGeometryX() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryX = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomGeometryX(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryX = func() null.Val[float64] { if f == nil { f = &defaultFaker } val := random_float64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomGeometryXNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryX = func() null.Val[float64] { if f == nil { f = &defaultFaker } val := random_float64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) GeometryY(val null.Val[float64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryY = func() null.Val[float64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryY = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetGeometryY() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryY = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomGeometryY(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryY = func() null.Val[float64] { if f == nil { f = &defaultFaker } val := random_float64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomGeometryYNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.GeometryY = func() null.Val[float64] { if f == nil { f = &defaultFaker } val := random_float64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) LastEditedDate(val null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedDate = func() null.Val[int64] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedDate = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetLastEditedDate() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedDate = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomLastEditedDate(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedDate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedDate = func() null.Val[int64] { if f == nil { f = &defaultFaker } val := random_int64(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) LastEditedUser(val null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedUser = func() null.Val[string] { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedUser = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetLastEditedUser() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedUser = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is sometimes null func (m fsContainerrelateMods) RandomLastEditedUser(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedUser = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used // The generated value is never null func (m fsContainerrelateMods) RandomLastEditedUserNotNull(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.LastEditedUser = func() null.Val[string] { if f == nil { f = &defaultFaker } val := random_string(f) return null.From(val) } }) } // Set the model columns to this value func (m fsContainerrelateMods) Updated(val time.Time) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Updated = func() time.Time { return val } }) } // Set the Column from the function func (m fsContainerrelateMods) UpdatedFunc(f func() time.Time) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Updated = f }) } // Clear any values for the column func (m fsContainerrelateMods) UnsetUpdated() FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Updated = nil }) } // Generates a random value for the column using the given faker // if faker is nil, a default faker is used func (m fsContainerrelateMods) RandomUpdated(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.Updated = func() time.Time { return random_time_Time(f) } }) } func (m fsContainerrelateMods) WithParentsCascading() FSContainerrelateMod { return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { if isDone, _ := fsContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fsContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) { related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) m.WithOrganization(related).Apply(ctx, o) } }) } func (m fsContainerrelateMods) WithOrganization(rel *OrganizationTemplate) FSContainerrelateMod { return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { o.r.Organization = &fsContainerrelateROrganizationR{ o: rel, } }) } func (m fsContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) FSContainerrelateMod { return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { related := o.f.NewOrganizationWithContext(ctx, mods...) m.WithOrganization(related).Apply(ctx, o) }) } func (m fsContainerrelateMods) WithExistingOrganization(em *models.Organization) FSContainerrelateMod { return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { o.r.Organization = &fsContainerrelateROrganizationR{ o: o.f.FromExistingOrganization(em), } }) } func (m fsContainerrelateMods) WithoutOrganization() FSContainerrelateMod { return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { o.r.Organization = nil }) }