nidus-sync/factory/fs_zones.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
36 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 FSZoneMod interface {
Apply(context.Context, *FSZoneTemplate)
}
type FSZoneModFunc func(context.Context, *FSZoneTemplate)
func (f FSZoneModFunc) Apply(ctx context.Context, n *FSZoneTemplate) {
f(ctx, n)
}
type FSZoneModSlice []FSZoneMod
func (mods FSZoneModSlice) Apply(ctx context.Context, n *FSZoneTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// FSZoneTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSZoneTemplate struct {
OrganizationID func() int32
Active func() null.Val[int64]
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]
Name func() null.Val[string]
Objectid func() int32
ShapeArea func() null.Val[float64]
ShapeLength func() null.Val[float64]
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 fsZoneR
f *Factory
alreadyPersisted bool
}
type fsZoneR struct {
Organization *fsZoneROrganizationR
}
type fsZoneROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the FSZoneTemplate
func (o *FSZoneTemplate) Apply(ctx context.Context, mods ...FSZoneMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.FSZone
// according to the relationships in the template. Nothing is inserted into the db
func (t FSZoneTemplate) setModelRels(o *models.FSZone) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSZones = append(rel.R.FSZones, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.FSZoneSetter
// this does nothing with the relationship templates
func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter {
m := &models.FSZoneSetter{}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omit.From(val)
}
if o.Active != nil {
val := o.Active()
m.Active = 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.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
}
if o.Name != nil {
val := o.Name()
m.Name = omitnull.FromNull(val)
}
if o.Objectid != nil {
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.ShapeArea != nil {
val := o.ShapeArea()
m.ShapeArea = omitnull.FromNull(val)
}
if o.ShapeLength != nil {
val := o.ShapeLength()
m.ShapeLength = 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.FSZoneSetter
// this does nothing with the relationship templates
func (o FSZoneTemplate) BuildManySetter(number int) []*models.FSZoneSetter {
m := make([]*models.FSZoneSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.FSZone
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.Create
func (o FSZoneTemplate) Build() *models.FSZone {
m := &models.FSZone{}
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
if o.Active != nil {
m.Active = o.Active()
}
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.Name != nil {
m.Name = o.Name()
}
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.ShapeArea != nil {
m.ShapeArea = o.ShapeArea()
}
if o.ShapeLength != nil {
m.ShapeLength = o.ShapeLength()
}
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.FSZoneSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.CreateMany
func (o FSZoneTemplate) BuildMany(number int) models.FSZoneSlice {
m := make(models.FSZoneSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableFSZone(m *models.FSZoneSetter) {
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.FSZone
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FSZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZone) error {
var err error
return err
}
// Create builds a fsZone and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *FSZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSZone, error) {
var err error
opt := o.BuildSetter()
ensureCreatableFSZone(opt)
if o.r.Organization == nil {
FSZoneMods.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.FSZones.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 fsZone and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FSZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSZone {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a fsZone 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 *FSZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSZone {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple fsZones and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o FSZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSZoneSlice, error) {
var err error
m := make(models.FSZoneSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple fsZones and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o FSZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSZoneSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple fsZones 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 FSZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSZoneSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// FSZone has methods that act as mods for the FSZoneTemplate
var FSZoneMods fsZoneMods
type fsZoneMods struct{}
func (m fsZoneMods) RandomizeAllColumns(f *faker.Faker) FSZoneMod {
return FSZoneModSlice{
FSZoneMods.RandomOrganizationID(f),
FSZoneMods.RandomActive(f),
FSZoneMods.RandomCreationdate(f),
FSZoneMods.RandomCreator(f),
FSZoneMods.RandomEditdate(f),
FSZoneMods.RandomEditor(f),
FSZoneMods.RandomGlobalid(f),
FSZoneMods.RandomName(f),
FSZoneMods.RandomObjectid(f),
FSZoneMods.RandomShapeArea(f),
FSZoneMods.RandomShapeLength(f),
FSZoneMods.RandomCreatedDate(f),
FSZoneMods.RandomCreatedUser(f),
FSZoneMods.RandomGeometryX(f),
FSZoneMods.RandomGeometryY(f),
FSZoneMods.RandomLastEditedDate(f),
FSZoneMods.RandomLastEditedUser(f),
FSZoneMods.RandomUpdated(f),
}
}
// Set the model columns to this value
func (m fsZoneMods) OrganizationID(val int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) OrganizationIDFunc(f func() int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetOrganizationID() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomOrganizationID(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fsZoneMods) Active(val null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Active = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) ActiveFunc(f func() null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Active = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetActive() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Active = 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 fsZoneMods) RandomActive(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Active = 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 fsZoneMods) RandomActiveNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Active = 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 fsZoneMods) Creationdate(val null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Creationdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) CreationdateFunc(f func() null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetCreationdate() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreationdate(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreationdateNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Creator(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) CreatorFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetCreator() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreator(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreatorNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Editdate(val null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Editdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) EditdateFunc(f func() null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetEditdate() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomEditdate(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomEditdateNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Editor(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) EditorFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetEditor() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomEditor(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomEditorNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Globalid(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) GlobalidFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetGlobalid() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGlobalid(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGlobalidNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Name(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Name = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) NameFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Name = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetName() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Name = 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 fsZoneMods) RandomName(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Name = 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 fsZoneMods) RandomNameNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Name = 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 fsZoneMods) Objectid(val int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Objectid = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) ObjectidFunc(f func() int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetObjectid() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomObjectid(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Objectid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fsZoneMods) ShapeArea(val null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeArea = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) ShapeAreaFunc(f func() null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeArea = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetShapeArea() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeArea = 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 fsZoneMods) RandomShapeArea(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeArea = 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 fsZoneMods) RandomShapeAreaNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeArea = 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 fsZoneMods) ShapeLength(val null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeLength = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) ShapeLengthFunc(f func() null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeLength = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetShapeLength() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeLength = 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 fsZoneMods) RandomShapeLength(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeLength = 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 fsZoneMods) RandomShapeLengthNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.ShapeLength = 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 fsZoneMods) CreatedDate(val null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.CreatedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) CreatedDateFunc(f func() null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetCreatedDate() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreatedDate(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreatedDateNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) CreatedUser(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) CreatedUserFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetCreatedUser() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreatedUser(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomCreatedUserNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) GeometryX(val null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) GeometryXFunc(f func() null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.GeometryX = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetGeometryX() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGeometryX(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGeometryXNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) GeometryY(val null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) GeometryYFunc(f func() null.Val[float64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.GeometryY = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetGeometryY() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGeometryY(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomGeometryYNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) LastEditedDate(val null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.LastEditedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) LastEditedDateFunc(f func() null.Val[int64]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetLastEditedDate() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomLastEditedDate(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomLastEditedDateNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) LastEditedUser(val null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) LastEditedUserFunc(f func() null.Val[string]) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetLastEditedUser() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomLastEditedUser(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomLastEditedUserNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) Updated(val time.Time) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Updated = func() time.Time { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) UpdatedFunc(f func() time.Time) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Updated = f
})
}
// Clear any values for the column
func (m fsZoneMods) UnsetUpdated() FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
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 fsZoneMods) RandomUpdated(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Updated = func() time.Time {
return random_time_Time(f)
}
})
}
func (m fsZoneMods) WithParentsCascading() FSZoneMod {
return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) {
if isDone, _ := fsZoneWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = fsZoneWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m fsZoneMods) WithOrganization(rel *OrganizationTemplate) FSZoneMod {
return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) {
o.r.Organization = &fsZoneROrganizationR{
o: rel,
}
})
}
func (m fsZoneMods) WithNewOrganization(mods ...OrganizationMod) FSZoneMod {
return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m fsZoneMods) WithExistingOrganization(em *models.Organization) FSZoneMod {
return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) {
o.r.Organization = &fsZoneROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m fsZoneMods) WithoutOrganization() FSZoneMod {
return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) {
o.r.Organization = nil
})
}