nidus-sync/factory/history_containerrelate.bob.go
Eli Ribble b0432f3243
Add statistics on the sync and save org ID with fieldseeker tables
We need the org ID so that we can avoid bleedover between different
organizations.
2025-11-07 09:30:31 +00:00

1408 lines
45 KiB
Go

// 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 HistoryContainerrelateMod interface {
Apply(context.Context, *HistoryContainerrelateTemplate)
}
type HistoryContainerrelateModFunc func(context.Context, *HistoryContainerrelateTemplate)
func (f HistoryContainerrelateModFunc) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) {
f(ctx, n)
}
type HistoryContainerrelateModSlice []HistoryContainerrelateMod
func (mods HistoryContainerrelateModSlice) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// HistoryContainerrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryContainerrelateTemplate 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]
Created func() null.Val[time.Time]
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]
Version func() int32
r historyContainerrelateR
f *Factory
alreadyPersisted bool
}
type historyContainerrelateR struct {
Organization *historyContainerrelateROrganizationR
}
type historyContainerrelateROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the HistoryContainerrelateTemplate
func (o *HistoryContainerrelateTemplate) Apply(ctx context.Context, mods ...HistoryContainerrelateMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.HistoryContainerrelate
// according to the relationships in the template. Nothing is inserted into the db
func (t HistoryContainerrelateTemplate) setModelRels(o *models.HistoryContainerrelate) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.HistoryContainerrelateSetter
// this does nothing with the relationship templates
func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerrelateSetter {
m := &models.HistoryContainerrelateSetter{}
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.Created != nil {
val := o.Created()
m.Created = 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.Version != nil {
val := o.Version()
m.Version = omit.From(val)
}
return m
}
// BuildManySetter returns an []*models.HistoryContainerrelateSetter
// this does nothing with the relationship templates
func (o HistoryContainerrelateTemplate) BuildManySetter(number int) []*models.HistoryContainerrelateSetter {
m := make([]*models.HistoryContainerrelateSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.HistoryContainerrelate
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.Create
func (o HistoryContainerrelateTemplate) Build() *models.HistoryContainerrelate {
m := &models.HistoryContainerrelate{}
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.Created != nil {
m.Created = o.Created()
}
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.Version != nil {
m.Version = o.Version()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.HistoryContainerrelateSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.CreateMany
func (o HistoryContainerrelateTemplate) BuildMany(number int) models.HistoryContainerrelateSlice {
m := make(models.HistoryContainerrelateSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSetter) {
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)
}
if !(m.Version.IsValue()) {
val := random_int32(nil)
m.Version = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.HistoryContainerrelate
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *HistoryContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryContainerrelate) error {
var err error
return err
}
// Create builds a historyContainerrelate and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *HistoryContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryContainerrelate, error) {
var err error
opt := o.BuildSetter()
ensureCreatableHistoryContainerrelate(opt)
if o.r.Organization == nil {
HistoryContainerrelateMods.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.HistoryContainerrelates.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 historyContainerrelate and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *HistoryContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryContainerrelate {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a historyContainerrelate 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 *HistoryContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryContainerrelate {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple historyContainerrelates and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o HistoryContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryContainerrelateSlice, error) {
var err error
m := make(models.HistoryContainerrelateSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple historyContainerrelates and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o HistoryContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryContainerrelateSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple historyContainerrelates 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 HistoryContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryContainerrelateSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// HistoryContainerrelate has methods that act as mods for the HistoryContainerrelateTemplate
var HistoryContainerrelateMods historyContainerrelateMods
type historyContainerrelateMods struct{}
func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModSlice{
HistoryContainerrelateMods.RandomOrganizationID(f),
HistoryContainerrelateMods.RandomContainertype(f),
HistoryContainerrelateMods.RandomCreationdate(f),
HistoryContainerrelateMods.RandomCreator(f),
HistoryContainerrelateMods.RandomEditdate(f),
HistoryContainerrelateMods.RandomEditor(f),
HistoryContainerrelateMods.RandomGlobalid(f),
HistoryContainerrelateMods.RandomInspsampleid(f),
HistoryContainerrelateMods.RandomMosquitoinspid(f),
HistoryContainerrelateMods.RandomObjectid(f),
HistoryContainerrelateMods.RandomTreatmentid(f),
HistoryContainerrelateMods.RandomCreated(f),
HistoryContainerrelateMods.RandomCreatedDate(f),
HistoryContainerrelateMods.RandomCreatedUser(f),
HistoryContainerrelateMods.RandomGeometryX(f),
HistoryContainerrelateMods.RandomGeometryY(f),
HistoryContainerrelateMods.RandomLastEditedDate(f),
HistoryContainerrelateMods.RandomLastEditedUser(f),
HistoryContainerrelateMods.RandomVersion(f),
}
}
// Set the model columns to this value
func (m historyContainerrelateMods) OrganizationID(val int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) OrganizationIDFunc(f func() int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetOrganizationID() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomOrganizationID(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m historyContainerrelateMods) Containertype(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Containertype = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Containertype = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetContainertype() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomContainertype(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomContainertypeNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Creationdate(val null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Creationdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreationdate() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreationdate(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreationdateNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Creator(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreatorFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreator() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreator(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreatorNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Editdate(val null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Editdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetEditdate() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomEditdate(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomEditdateNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Editor(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) EditorFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetEditor() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomEditor(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomEditorNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Globalid(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Globalid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetGlobalid() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGlobalid(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGlobalidNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Inspsampleid(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Inspsampleid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Inspsampleid = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetInspsampleid() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomInspsampleid(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomInspsampleidNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Mosquitoinspid(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Mosquitoinspid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Mosquitoinspid = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetMosquitoinspid() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomMosquitoinspidNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Objectid(val int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Objectid = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) ObjectidFunc(f func() int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetObjectid() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomObjectid(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Objectid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m historyContainerrelateMods) Treatmentid(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Treatmentid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Treatmentid = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetTreatmentid() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomTreatmentid(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Created(val null.Val[time.Time]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreated() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = 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 historyContainerrelateMods) RandomCreated(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(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 historyContainerrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyContainerrelateMods) CreatedDate(val null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.CreatedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreatedDate() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreatedDate(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) CreatedUser(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreatedUser() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreatedUser(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) GeometryX(val null.Val[float64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.GeometryX = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetGeometryX() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGeometryX(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGeometryXNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) GeometryY(val null.Val[float64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.GeometryY = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetGeometryY() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGeometryY(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomGeometryYNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) LastEditedDate(val null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.LastEditedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetLastEditedDate() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomLastEditedDate(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) LastEditedUser(val null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetLastEditedUser() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomLastEditedUser(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
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 historyContainerrelateMods) Version(val int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Version = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) VersionFunc(f func() int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Version = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetVersion() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Version = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m historyContainerrelateMods) RandomVersion(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Version = func() int32 {
return random_int32(f)
}
})
}
func (m historyContainerrelateMods) WithParentsCascading() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) {
if isDone, _ := historyContainerrelateWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = historyContainerrelateWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m historyContainerrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) {
o.r.Organization = &historyContainerrelateROrganizationR{
o: rel,
}
})
}
func (m historyContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m historyContainerrelateMods) WithExistingOrganization(em *models.Organization) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) {
o.r.Organization = &historyContainerrelateROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m historyContainerrelateMods) WithoutOrganization() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) {
o.r.Organization = nil
})
}