nidus-sync/factory/fs_pooldetail.bob.go

1361 lines
39 KiB
Go
Raw Normal View History

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