nidus-sync/factory/fs_inspectionsample.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

1342 lines
41 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 FSInspectionsampleMod interface {
Apply(context.Context, *FSInspectionsampleTemplate)
}
type FSInspectionsampleModFunc func(context.Context, *FSInspectionsampleTemplate)
func (f FSInspectionsampleModFunc) Apply(ctx context.Context, n *FSInspectionsampleTemplate) {
f(ctx, n)
}
type FSInspectionsampleModSlice []FSInspectionsampleMod
func (mods FSInspectionsampleModSlice) Apply(ctx context.Context, n *FSInspectionsampleTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// FSInspectionsampleTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSInspectionsampleTemplate struct {
OrganizationID func() int32
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]
Idbytech func() null.Val[string]
InspID func() null.Val[string]
Objectid func() int32
Processed func() null.Val[int16]
Sampleid 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 fsInspectionsampleR
f *Factory
alreadyPersisted bool
}
type fsInspectionsampleR struct {
Organization *fsInspectionsampleROrganizationR
}
type fsInspectionsampleROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the FSInspectionsampleTemplate
func (o *FSInspectionsampleTemplate) Apply(ctx context.Context, mods ...FSInspectionsampleMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.FSInspectionsample
// according to the relationships in the template. Nothing is inserted into the db
func (t FSInspectionsampleTemplate) setModelRels(o *models.FSInspectionsample) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSInspectionsamples = append(rel.R.FSInspectionsamples, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.FSInspectionsampleSetter
// this does nothing with the relationship templates
func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSetter {
m := &models.FSInspectionsampleSetter{}
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.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
}
if o.Idbytech != nil {
val := o.Idbytech()
m.Idbytech = omitnull.FromNull(val)
}
if o.InspID != nil {
val := o.InspID()
m.InspID = omitnull.FromNull(val)
}
if o.Objectid != nil {
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.Processed != nil {
val := o.Processed()
m.Processed = omitnull.FromNull(val)
}
if o.Sampleid != nil {
val := o.Sampleid()
m.Sampleid = 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.FSInspectionsampleSetter
// this does nothing with the relationship templates
func (o FSInspectionsampleTemplate) BuildManySetter(number int) []*models.FSInspectionsampleSetter {
m := make([]*models.FSInspectionsampleSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.FSInspectionsample
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.Create
func (o FSInspectionsampleTemplate) Build() *models.FSInspectionsample {
m := &models.FSInspectionsample{}
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.Globalid != nil {
m.Globalid = o.Globalid()
}
if o.Idbytech != nil {
m.Idbytech = o.Idbytech()
}
if o.InspID != nil {
m.InspID = o.InspID()
}
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.Processed != nil {
m.Processed = o.Processed()
}
if o.Sampleid != nil {
m.Sampleid = o.Sampleid()
}
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.FSInspectionsampleSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.CreateMany
func (o FSInspectionsampleTemplate) BuildMany(number int) models.FSInspectionsampleSlice {
m := make(models.FSInspectionsampleSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.FSInspectionsample
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FSInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsample) error {
var err error
return err
}
// Create builds a fsInspectionsample and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *FSInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSInspectionsample, error) {
var err error
opt := o.BuildSetter()
ensureCreatableFSInspectionsample(opt)
if o.r.Organization == nil {
FSInspectionsampleMods.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.FSInspectionsamples.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 fsInspectionsample and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FSInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSInspectionsample {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a fsInspectionsample 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 *FSInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSInspectionsample {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple fsInspectionsamples and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o FSInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSInspectionsampleSlice, error) {
var err error
m := make(models.FSInspectionsampleSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple fsInspectionsamples and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o FSInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSInspectionsampleSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple fsInspectionsamples 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 FSInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSInspectionsampleSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// FSInspectionsample has methods that act as mods for the FSInspectionsampleTemplate
var FSInspectionsampleMods fsInspectionsampleMods
type fsInspectionsampleMods struct{}
func (m fsInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModSlice{
FSInspectionsampleMods.RandomOrganizationID(f),
FSInspectionsampleMods.RandomCreationdate(f),
FSInspectionsampleMods.RandomCreator(f),
FSInspectionsampleMods.RandomEditdate(f),
FSInspectionsampleMods.RandomEditor(f),
FSInspectionsampleMods.RandomGlobalid(f),
FSInspectionsampleMods.RandomIdbytech(f),
FSInspectionsampleMods.RandomInspID(f),
FSInspectionsampleMods.RandomObjectid(f),
FSInspectionsampleMods.RandomProcessed(f),
FSInspectionsampleMods.RandomSampleid(f),
FSInspectionsampleMods.RandomCreatedDate(f),
FSInspectionsampleMods.RandomCreatedUser(f),
FSInspectionsampleMods.RandomGeometryX(f),
FSInspectionsampleMods.RandomGeometryY(f),
FSInspectionsampleMods.RandomLastEditedDate(f),
FSInspectionsampleMods.RandomLastEditedUser(f),
FSInspectionsampleMods.RandomUpdated(f),
}
}
// Set the model columns to this value
func (m fsInspectionsampleMods) OrganizationID(val int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) OrganizationIDFunc(f func() int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetOrganizationID() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fsInspectionsampleMods) Creationdate(val null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Creationdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) CreationdateFunc(f func() null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetCreationdate() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreationdate(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreationdateNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Creator(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) CreatorFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetCreator() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreator(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreatorNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Editdate(val null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Editdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) EditdateFunc(f func() null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetEditdate() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomEditdate(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomEditdateNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Editor(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) EditorFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetEditor() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomEditor(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomEditorNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Globalid(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) GlobalidFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetGlobalid() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGlobalid(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGlobalidNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Idbytech(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Idbytech = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Idbytech = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetIdbytech() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Idbytech = 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 fsInspectionsampleMods) RandomIdbytech(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Idbytech = 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 fsInspectionsampleMods) RandomIdbytechNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Idbytech = 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 fsInspectionsampleMods) InspID(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.InspID = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) InspIDFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.InspID = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetInspID() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.InspID = 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 fsInspectionsampleMods) RandomInspID(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.InspID = 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 fsInspectionsampleMods) RandomInspIDNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.InspID = 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 fsInspectionsampleMods) Objectid(val int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Objectid = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) ObjectidFunc(f func() int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetObjectid() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomObjectid(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Objectid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fsInspectionsampleMods) Processed(val null.Val[int16]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Processed = func() null.Val[int16] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Processed = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetProcessed() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Processed = 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 fsInspectionsampleMods) RandomProcessed(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Processed = 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 fsInspectionsampleMods) RandomProcessedNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Processed = 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 fsInspectionsampleMods) Sampleid(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Sampleid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) SampleidFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Sampleid = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetSampleid() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Sampleid = 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 fsInspectionsampleMods) RandomSampleid(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Sampleid = 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 fsInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Sampleid = 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 fsInspectionsampleMods) CreatedDate(val null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.CreatedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) CreatedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetCreatedDate() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreatedDate(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreatedDateNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) CreatedUser(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetCreatedUser() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreatedUser(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomCreatedUserNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) GeometryX(val null.Val[float64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) GeometryXFunc(f func() null.Val[float64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.GeometryX = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetGeometryX() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGeometryX(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGeometryXNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) GeometryY(val null.Val[float64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) GeometryYFunc(f func() null.Val[float64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.GeometryY = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetGeometryY() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGeometryY(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomGeometryYNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) LastEditedDate(val null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.LastEditedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) LastEditedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetLastEditedDate() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomLastEditedDateNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) LastEditedUser(val null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetLastEditedUser() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomLastEditedUserNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) Updated(val time.Time) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Updated = func() time.Time { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) UpdatedFunc(f func() time.Time) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Updated = f
})
}
// Clear any values for the column
func (m fsInspectionsampleMods) UnsetUpdated() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
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 fsInspectionsampleMods) RandomUpdated(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Updated = func() time.Time {
return random_time_Time(f)
}
})
}
func (m fsInspectionsampleMods) WithParentsCascading() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) {
if isDone, _ := fsInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = fsInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m fsInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) {
o.r.Organization = &fsInspectionsampleROrganizationR{
o: rel,
}
})
}
func (m fsInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m fsInspectionsampleMods) WithExistingOrganization(em *models.Organization) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) {
o.r.Organization = &fsInspectionsampleROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m fsInspectionsampleMods) WithoutOrganization() FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) {
o.r.Organization = nil
})
}