nidus-sync/factory/history_pooldetail.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
43 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 HistoryPooldetailMod interface {
Apply(context.Context, *HistoryPooldetailTemplate)
}
type HistoryPooldetailModFunc func(context.Context, *HistoryPooldetailTemplate)
func (f HistoryPooldetailModFunc) Apply(ctx context.Context, n *HistoryPooldetailTemplate) {
f(ctx, n)
}
type HistoryPooldetailModSlice []HistoryPooldetailMod
func (mods HistoryPooldetailModSlice) Apply(ctx context.Context, n *HistoryPooldetailTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// HistoryPooldetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryPooldetailTemplate struct {
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Females func() null.Val[int16]
Globalid func() null.Val[string]
Objectid func() int32
PoolID func() null.Val[string]
Species func() null.Val[string]
TrapdataID 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 historyPooldetailR
f *Factory
alreadyPersisted bool
}
type historyPooldetailR struct {
Organization *historyPooldetailROrganizationR
}
type historyPooldetailROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the HistoryPooldetailTemplate
func (o *HistoryPooldetailTemplate) Apply(ctx context.Context, mods ...HistoryPooldetailMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.HistoryPooldetail
// according to the relationships in the template. Nothing is inserted into the db
func (t HistoryPooldetailTemplate) setModelRels(o *models.HistoryPooldetail) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryPooldetails = append(rel.R.HistoryPooldetails, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.HistoryPooldetailSetter
// this does nothing with the relationship templates
func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter {
m := &models.HistoryPooldetailSetter{}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omit.From(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.Females != nil {
val := o.Females()
m.Females = omitnull.FromNull(val)
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
}
if o.Objectid != nil {
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.PoolID != nil {
val := o.PoolID()
m.PoolID = omitnull.FromNull(val)
}
if o.Species != nil {
val := o.Species()
m.Species = omitnull.FromNull(val)
}
if o.TrapdataID != nil {
val := o.TrapdataID()
m.TrapdataID = 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.HistoryPooldetailSetter
// this does nothing with the relationship templates
func (o HistoryPooldetailTemplate) BuildManySetter(number int) []*models.HistoryPooldetailSetter {
m := make([]*models.HistoryPooldetailSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.HistoryPooldetail
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.Create
func (o HistoryPooldetailTemplate) Build() *models.HistoryPooldetail {
m := &models.HistoryPooldetail{}
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
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.Females != nil {
m.Females = o.Females()
}
if o.Globalid != nil {
m.Globalid = o.Globalid()
}
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.PoolID != nil {
m.PoolID = o.PoolID()
}
if o.Species != nil {
m.Species = o.Species()
}
if o.TrapdataID != nil {
m.TrapdataID = o.TrapdataID()
}
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.HistoryPooldetailSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.CreateMany
func (o HistoryPooldetailTemplate) BuildMany(number int) models.HistoryPooldetailSlice {
m := make(models.HistoryPooldetailSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) {
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.HistoryPooldetail
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *HistoryPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPooldetail) error {
var err error
return err
}
// Create builds a historyPooldetail and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *HistoryPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPooldetail, error) {
var err error
opt := o.BuildSetter()
ensureCreatableHistoryPooldetail(opt)
if o.r.Organization == nil {
HistoryPooldetailMods.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.HistoryPooldetails.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 historyPooldetail and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *HistoryPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPooldetail {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a historyPooldetail 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 *HistoryPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPooldetail {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple historyPooldetails and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o HistoryPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPooldetailSlice, error) {
var err error
m := make(models.HistoryPooldetailSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple historyPooldetails and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o HistoryPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPooldetailSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple historyPooldetails 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 HistoryPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPooldetailSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// HistoryPooldetail has methods that act as mods for the HistoryPooldetailTemplate
var HistoryPooldetailMods historyPooldetailMods
type historyPooldetailMods struct{}
func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModSlice{
HistoryPooldetailMods.RandomOrganizationID(f),
HistoryPooldetailMods.RandomCreationdate(f),
HistoryPooldetailMods.RandomCreator(f),
HistoryPooldetailMods.RandomEditdate(f),
HistoryPooldetailMods.RandomEditor(f),
HistoryPooldetailMods.RandomFemales(f),
HistoryPooldetailMods.RandomGlobalid(f),
HistoryPooldetailMods.RandomObjectid(f),
HistoryPooldetailMods.RandomPoolID(f),
HistoryPooldetailMods.RandomSpecies(f),
HistoryPooldetailMods.RandomTrapdataID(f),
HistoryPooldetailMods.RandomCreated(f),
HistoryPooldetailMods.RandomCreatedDate(f),
HistoryPooldetailMods.RandomCreatedUser(f),
HistoryPooldetailMods.RandomGeometryX(f),
HistoryPooldetailMods.RandomGeometryY(f),
HistoryPooldetailMods.RandomLastEditedDate(f),
HistoryPooldetailMods.RandomLastEditedUser(f),
HistoryPooldetailMods.RandomVersion(f),
}
}
// Set the model columns to this value
func (m historyPooldetailMods) OrganizationID(val int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) OrganizationIDFunc(f func() int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetOrganizationID() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomOrganizationID(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m historyPooldetailMods) Creationdate(val null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Creationdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreationdateFunc(f func() null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreationdate() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreationdate(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreationdateNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Creator(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreatorFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreator() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreator(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatorNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Editdate(val null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Editdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) EditdateFunc(f func() null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetEditdate() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomEditdate(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomEditdateNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Editor(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) EditorFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetEditor() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomEditor(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomEditorNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Females(val null.Val[int16]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Females = func() null.Val[int16] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) FemalesFunc(f func() null.Val[int16]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Females = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetFemales() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Females = 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 historyPooldetailMods) RandomFemales(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Females = func() null.Val[int16] {
if f == nil {
f = &defaultFaker
}
val := random_int16(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 historyPooldetailMods) RandomFemalesNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Females = func() null.Val[int16] {
if f == nil {
f = &defaultFaker
}
val := random_int16(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyPooldetailMods) Globalid(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Globalid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) GlobalidFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetGlobalid() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGlobalid(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGlobalidNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Objectid(val int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Objectid = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) ObjectidFunc(f func() int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetObjectid() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomObjectid(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Objectid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m historyPooldetailMods) PoolID(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.PoolID = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) PoolIDFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.PoolID = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetPoolID() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.PoolID = 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 historyPooldetailMods) RandomPoolID(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.PoolID = 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 historyPooldetailMods) RandomPoolIDNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.PoolID = 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 historyPooldetailMods) Species(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Species = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) SpeciesFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Species = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetSpecies() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Species = 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 historyPooldetailMods) RandomSpecies(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Species = 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 historyPooldetailMods) RandomSpeciesNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Species = 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 historyPooldetailMods) TrapdataID(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.TrapdataID = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) TrapdataIDFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.TrapdataID = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetTrapdataID() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.TrapdataID = 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 historyPooldetailMods) RandomTrapdataID(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.TrapdataID = 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 historyPooldetailMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.TrapdataID = 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 historyPooldetailMods) Created(val null.Val[time.Time]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreated() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreated(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) CreatedDate(val null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.CreatedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreatedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreatedDate() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatedDate(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) CreatedUser(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreatedUserFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreatedUser() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatedUser(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) GeometryX(val null.Val[float64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) GeometryXFunc(f func() null.Val[float64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.GeometryX = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetGeometryX() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGeometryX(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGeometryXNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) GeometryY(val null.Val[float64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) GeometryYFunc(f func() null.Val[float64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.GeometryY = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetGeometryY() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGeometryY(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomGeometryYNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) LastEditedDate(val null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.LastEditedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetLastEditedDate() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomLastEditedDate(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) LastEditedUser(val null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetLastEditedUser() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomLastEditedUser(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) Version(val int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Version = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) VersionFunc(f func() int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Version = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetVersion() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
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 historyPooldetailMods) RandomVersion(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Version = func() int32 {
return random_int32(f)
}
})
}
func (m historyPooldetailMods) WithParentsCascading() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) {
if isDone, _ := historyPooldetailWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = historyPooldetailWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m historyPooldetailMods) WithOrganization(rel *OrganizationTemplate) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) {
o.r.Organization = &historyPooldetailROrganizationR{
o: rel,
}
})
}
func (m historyPooldetailMods) WithNewOrganization(mods ...OrganizationMod) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m historyPooldetailMods) WithExistingOrganization(em *models.Organization) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) {
o.r.Organization = &historyPooldetailROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m historyPooldetailMods) WithoutOrganization() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) {
o.r.Organization = nil
})
}