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

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