nidus-sync/db/factory/fieldseeker.inspectionsample.bob.go
Eli Ribble 1aefca2f5d Make GlobalID required for all Fieldseeker tables
I'm pretty sure it has to be there, and it allows me to clean up my
code.
2026-01-05 02:28:28 +00:00

1305 lines
44 KiB
Go

// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package factory
import (
"context"
"encoding/json"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/aarondl/opt/null"
"github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull"
"github.com/google/uuid"
"github.com/jaswdr/faker/v2"
"github.com/stephenafamo/bob"
"github.com/stephenafamo/bob/types"
)
type FieldseekerInspectionsampleMod interface {
Apply(context.Context, *FieldseekerInspectionsampleTemplate)
}
type FieldseekerInspectionsampleModFunc func(context.Context, *FieldseekerInspectionsampleTemplate)
func (f FieldseekerInspectionsampleModFunc) Apply(ctx context.Context, n *FieldseekerInspectionsampleTemplate) {
f(ctx, n)
}
type FieldseekerInspectionsampleModSlice []FieldseekerInspectionsampleMod
func (mods FieldseekerInspectionsampleModSlice) Apply(ctx context.Context, n *FieldseekerInspectionsampleTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// FieldseekerInspectionsampleTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FieldseekerInspectionsampleTemplate struct {
Objectid func() int64
InspID func() null.Val[uuid.UUID]
Sampleid func() null.Val[string]
Processed func() null.Val[int16]
Idbytech func() null.Val[string]
Globalid func() uuid.UUID
CreatedUser func() null.Val[string]
CreatedDate func() null.Val[time.Time]
LastEditedUser func() null.Val[string]
LastEditedDate func() null.Val[time.Time]
Creationdate func() null.Val[time.Time]
Creator func() null.Val[string]
Editdate func() null.Val[time.Time]
Editor func() null.Val[string]
Geometry func() types.JSON[json.RawMessage]
Geospatial func() null.Val[string]
Version func() int32
OrganizationID func() int32
r fieldseekerInspectionsampleR
f *Factory
alreadyPersisted bool
}
type fieldseekerInspectionsampleR struct {
Organization *fieldseekerInspectionsampleROrganizationR
}
type fieldseekerInspectionsampleROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the FieldseekerInspectionsampleTemplate
func (o *FieldseekerInspectionsampleTemplate) Apply(ctx context.Context, mods ...FieldseekerInspectionsampleMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.FieldseekerInspectionsample
// according to the relationships in the template. Nothing is inserted into the db
func (t FieldseekerInspectionsampleTemplate) setModelRels(o *models.FieldseekerInspectionsample) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.Inspectionsamples = append(rel.R.Inspectionsamples, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.FieldseekerInspectionsampleSetter
// this does nothing with the relationship templates
func (o FieldseekerInspectionsampleTemplate) BuildSetter() *models.FieldseekerInspectionsampleSetter {
m := &models.FieldseekerInspectionsampleSetter{}
if o.Objectid != nil {
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.InspID != nil {
val := o.InspID()
m.InspID = omitnull.FromNull(val)
}
if o.Sampleid != nil {
val := o.Sampleid()
m.Sampleid = omitnull.FromNull(val)
}
if o.Processed != nil {
val := o.Processed()
m.Processed = omitnull.FromNull(val)
}
if o.Idbytech != nil {
val := o.Idbytech()
m.Idbytech = omitnull.FromNull(val)
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omit.From(val)
}
if o.CreatedUser != nil {
val := o.CreatedUser()
m.CreatedUser = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
}
if o.LastEditedUser != nil {
val := o.LastEditedUser()
m.LastEditedUser = omitnull.FromNull(val)
}
if o.LastEditedDate != nil {
val := o.LastEditedDate()
m.LastEditedDate = 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.Geometry != nil {
val := o.Geometry()
m.Geometry = omit.From(val)
}
if o.Geospatial != nil {
val := o.Geospatial()
m.Geospatial = omitnull.FromNull(val)
}
if o.Version != nil {
val := o.Version()
m.Version = omit.From(val)
}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omit.From(val)
}
return m
}
// BuildManySetter returns an []*models.FieldseekerInspectionsampleSetter
// this does nothing with the relationship templates
func (o FieldseekerInspectionsampleTemplate) BuildManySetter(number int) []*models.FieldseekerInspectionsampleSetter {
m := make([]*models.FieldseekerInspectionsampleSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.FieldseekerInspectionsample
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampleTemplate.Create
func (o FieldseekerInspectionsampleTemplate) Build() *models.FieldseekerInspectionsample {
m := &models.FieldseekerInspectionsample{}
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.InspID != nil {
m.InspID = o.InspID()
}
if o.Sampleid != nil {
m.Sampleid = o.Sampleid()
}
if o.Processed != nil {
m.Processed = o.Processed()
}
if o.Idbytech != nil {
m.Idbytech = o.Idbytech()
}
if o.Globalid != nil {
m.Globalid = o.Globalid()
}
if o.CreatedUser != nil {
m.CreatedUser = o.CreatedUser()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
if o.LastEditedUser != nil {
m.LastEditedUser = o.LastEditedUser()
}
if o.LastEditedDate != nil {
m.LastEditedDate = o.LastEditedDate()
}
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.Geometry != nil {
m.Geometry = o.Geometry()
}
if o.Geospatial != nil {
m.Geospatial = o.Geospatial()
}
if o.Version != nil {
m.Version = o.Version()
}
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.FieldseekerInspectionsampleSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampleTemplate.CreateMany
func (o FieldseekerInspectionsampleTemplate) BuildMany(number int) models.FieldseekerInspectionsampleSlice {
m := make(models.FieldseekerInspectionsampleSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableFieldseekerInspectionsample(m *models.FieldseekerInspectionsampleSetter) {
if !(m.Globalid.IsValue()) {
val := random_uuid_UUID(nil)
m.Globalid = omit.From(val)
}
if !(m.Geometry.IsValue()) {
val := random_types_JSON_json_RawMessage_(nil)
m.Geometry = omit.From(val)
}
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.FieldseekerInspectionsample
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FieldseekerInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerInspectionsample) error {
var err error
return err
}
// Create builds a fieldseekerInspectionsample and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *FieldseekerInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerInspectionsample, error) {
var err error
opt := o.BuildSetter()
ensureCreatableFieldseekerInspectionsample(opt)
if o.r.Organization == nil {
FieldseekerInspectionsampleMods.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.FieldseekerInspectionsamples.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 fieldseekerInspectionsample and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FieldseekerInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerInspectionsample {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a fieldseekerInspectionsample 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 *FieldseekerInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerInspectionsample {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple fieldseekerInspectionsamples and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o FieldseekerInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerInspectionsampleSlice, error) {
var err error
m := make(models.FieldseekerInspectionsampleSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple fieldseekerInspectionsamples and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o FieldseekerInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerInspectionsampleSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple fieldseekerInspectionsamples 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 FieldseekerInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerInspectionsampleSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// FieldseekerInspectionsample has methods that act as mods for the FieldseekerInspectionsampleTemplate
var FieldseekerInspectionsampleMods fieldseekerInspectionsampleMods
type fieldseekerInspectionsampleMods struct{}
func (m fieldseekerInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModSlice{
FieldseekerInspectionsampleMods.RandomObjectid(f),
FieldseekerInspectionsampleMods.RandomInspID(f),
FieldseekerInspectionsampleMods.RandomSampleid(f),
FieldseekerInspectionsampleMods.RandomProcessed(f),
FieldseekerInspectionsampleMods.RandomIdbytech(f),
FieldseekerInspectionsampleMods.RandomGlobalid(f),
FieldseekerInspectionsampleMods.RandomCreatedUser(f),
FieldseekerInspectionsampleMods.RandomCreatedDate(f),
FieldseekerInspectionsampleMods.RandomLastEditedUser(f),
FieldseekerInspectionsampleMods.RandomLastEditedDate(f),
FieldseekerInspectionsampleMods.RandomCreationdate(f),
FieldseekerInspectionsampleMods.RandomCreator(f),
FieldseekerInspectionsampleMods.RandomEditdate(f),
FieldseekerInspectionsampleMods.RandomEditor(f),
FieldseekerInspectionsampleMods.RandomGeometry(f),
FieldseekerInspectionsampleMods.RandomGeospatial(f),
FieldseekerInspectionsampleMods.RandomVersion(f),
FieldseekerInspectionsampleMods.RandomOrganizationID(f),
}
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Objectid(val int64) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Objectid = func() int64 { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) ObjectidFunc(f func() int64) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetObjectid() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomObjectid(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Objectid = func() int64 {
return random_int64(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) InspID(val null.Val[uuid.UUID]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.InspID = func() null.Val[uuid.UUID] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) InspIDFunc(f func() null.Val[uuid.UUID]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.InspID = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetInspID() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomInspID(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.InspID = func() null.Val[uuid.UUID] {
if f == nil {
f = &defaultFaker
}
val := random_uuid_UUID(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 fieldseekerInspectionsampleMods) RandomInspIDNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.InspID = func() null.Val[uuid.UUID] {
if f == nil {
f = &defaultFaker
}
val := random_uuid_UUID(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Sampleid(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Sampleid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) SampleidFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Sampleid = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetSampleid() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomSampleid(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Sampleid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "25")
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 fieldseekerInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Sampleid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "25")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Processed(val null.Val[int16]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Processed = func() null.Val[int16] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Processed = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetProcessed() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomProcessed(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) Idbytech(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Idbytech = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Idbytech = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetIdbytech() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomIdbytech(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Idbytech = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "25")
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 fieldseekerInspectionsampleMods) RandomIdbytechNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Idbytech = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "25")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Globalid(val uuid.UUID) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Globalid = func() uuid.UUID { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) GlobalidFunc(f func() uuid.UUID) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetGlobalid() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Globalid = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerInspectionsampleMods) RandomGlobalid(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Globalid = func() uuid.UUID {
return random_uuid_UUID(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) CreatedUser(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetCreatedUser() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomCreatedUser(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedUser = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "255")
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 fieldseekerInspectionsampleMods) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedUser = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "255")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) CreatedDate(val null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedDate = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetCreatedDate() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomCreatedDate(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedDate = 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 fieldseekerInspectionsampleMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.CreatedDate = 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 fieldseekerInspectionsampleMods) LastEditedUser(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetLastEditedUser() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedUser = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "255")
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 fieldseekerInspectionsampleMods) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedUser = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "255")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) LastEditedDate(val null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedDate = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetLastEditedDate() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedDate = 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 fieldseekerInspectionsampleMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.LastEditedDate = 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 fieldseekerInspectionsampleMods) Creationdate(val null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creationdate = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetCreationdate() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomCreationdate(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creationdate = 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 fieldseekerInspectionsampleMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creationdate = 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 fieldseekerInspectionsampleMods) Creator(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) CreatorFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetCreator() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomCreator(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creator = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "128")
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 fieldseekerInspectionsampleMods) RandomCreatorNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Creator = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "128")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Editdate(val null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editdate = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetEditdate() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomEditdate(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editdate = 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 fieldseekerInspectionsampleMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editdate = 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 fieldseekerInspectionsampleMods) Editor(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) EditorFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetEditor() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomEditor(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editor = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "128")
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 fieldseekerInspectionsampleMods) RandomEditorNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Editor = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "128")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geometry = func() types.JSON[json.RawMessage] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geometry = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetGeometry() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geometry = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerInspectionsampleMods) RandomGeometry(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geometry = func() types.JSON[json.RawMessage] {
return random_types_JSON_json_RawMessage_(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) Geospatial(val null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geospatial = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) GeospatialFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geospatial = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetGeospatial() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geospatial = 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 fieldseekerInspectionsampleMods) RandomGeospatial(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geospatial = 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 fieldseekerInspectionsampleMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Geospatial = 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 fieldseekerInspectionsampleMods) Version(val int32) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Version = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) VersionFunc(f func() int32) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Version = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetVersion() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomVersion(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.Version = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerInspectionsampleMods) OrganizationID(val int32) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerInspectionsampleMods) OrganizationIDFunc(f func() int32) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m fieldseekerInspectionsampleMods) UnsetOrganizationID() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
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 fieldseekerInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
func (m fieldseekerInspectionsampleMods) WithParentsCascading() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) {
if isDone, _ := fieldseekerInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = fieldseekerInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m fieldseekerInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) {
o.r.Organization = &fieldseekerInspectionsampleROrganizationR{
o: rel,
}
})
}
func (m fieldseekerInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m fieldseekerInspectionsampleMods) WithExistingOrganization(em *models.Organization) FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) {
o.r.Organization = &fieldseekerInspectionsampleROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m fieldseekerInspectionsampleMods) WithoutOrganization() FieldseekerInspectionsampleMod {
return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) {
o.r.Organization = nil
})
}