nidus-sync/factory/fs_zones2.bob.go
Eli Ribble e48abb09c0
Go to h3 v4, Add initial h3 aggregation work
This calculates the summary information of data in h3 nodes and puts it
in the database for fast lookup.
2025-11-13 23:49:12 +00:00

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