nidus-sync/factory/history_habitatrelate.bob.go
Eli Ribble 9010726707
Add initial synchronization of Fieldseeker data by oauth
This involves a lot of copy-pasta of code from the previous version of
this logic in another code base. It'll need to be cleaned up, but for
now I need something sooner rather than later.
2025-11-07 08:34:32 +00:00

1239 lines
39 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"
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 HistoryHabitatrelateMod interface {
Apply(context.Context, *HistoryHabitatrelateTemplate)
}
type HistoryHabitatrelateModFunc func(context.Context, *HistoryHabitatrelateTemplate)
func (f HistoryHabitatrelateModFunc) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) {
f(ctx, n)
}
type HistoryHabitatrelateModSlice []HistoryHabitatrelateMod
func (mods HistoryHabitatrelateModSlice) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// HistoryHabitatrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryHabitatrelateTemplate struct {
OrganizationID func() null.Val[int32]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
ForeignID func() null.Val[string]
Globalid func() null.Val[string]
Habitattype func() null.Val[string]
Objectid func() int32
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 historyHabitatrelateR
f *Factory
alreadyPersisted bool
}
type historyHabitatrelateR struct {
Organization *historyHabitatrelateROrganizationR
}
type historyHabitatrelateROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the HistoryHabitatrelateTemplate
func (o *HistoryHabitatrelateTemplate) Apply(ctx context.Context, mods ...HistoryHabitatrelateMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.HistoryHabitatrelate
// according to the relationships in the template. Nothing is inserted into the db
func (t HistoryHabitatrelateTemplate) setModelRels(o *models.HistoryHabitatrelate) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o)
o.OrganizationID = null.From(rel.ID) // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.HistoryHabitatrelateSetter
// this does nothing with the relationship templates
func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelateSetter {
m := &models.HistoryHabitatrelateSetter{}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = 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.ForeignID != nil {
val := o.ForeignID()
m.ForeignID = omitnull.FromNull(val)
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
}
if o.Habitattype != nil {
val := o.Habitattype()
m.Habitattype = omitnull.FromNull(val)
}
if o.Objectid != nil {
val := o.Objectid()
m.Objectid = omit.From(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.HistoryHabitatrelateSetter
// this does nothing with the relationship templates
func (o HistoryHabitatrelateTemplate) BuildManySetter(number int) []*models.HistoryHabitatrelateSetter {
m := make([]*models.HistoryHabitatrelateSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.HistoryHabitatrelate
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.Create
func (o HistoryHabitatrelateTemplate) Build() *models.HistoryHabitatrelate {
m := &models.HistoryHabitatrelate{}
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.ForeignID != nil {
m.ForeignID = o.ForeignID()
}
if o.Globalid != nil {
m.Globalid = o.Globalid()
}
if o.Habitattype != nil {
m.Habitattype = o.Habitattype()
}
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
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.HistoryHabitatrelateSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.CreateMany
func (o HistoryHabitatrelateTemplate) BuildMany(number int) models.HistoryHabitatrelateSlice {
m := make(models.HistoryHabitatrelateSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) {
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.HistoryHabitatrelate
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *HistoryHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryHabitatrelate) error {
var err error
isOrganizationDone, _ := historyHabitatrelateRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyHabitatrelateRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
// Create builds a historyHabitatrelate and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *HistoryHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryHabitatrelate, error) {
var err error
opt := o.BuildSetter()
ensureCreatableHistoryHabitatrelate(opt)
m, err := models.HistoryHabitatrelates.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
return m, err
}
// MustCreate builds a historyHabitatrelate and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *HistoryHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryHabitatrelate {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a historyHabitatrelate 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 *HistoryHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryHabitatrelate {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple historyHabitatrelates and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o HistoryHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryHabitatrelateSlice, error) {
var err error
m := make(models.HistoryHabitatrelateSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple historyHabitatrelates and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o HistoryHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryHabitatrelateSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple historyHabitatrelates 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 HistoryHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryHabitatrelateSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// HistoryHabitatrelate has methods that act as mods for the HistoryHabitatrelateTemplate
var HistoryHabitatrelateMods historyHabitatrelateMods
type historyHabitatrelateMods struct{}
func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModSlice{
HistoryHabitatrelateMods.RandomOrganizationID(f),
HistoryHabitatrelateMods.RandomCreationdate(f),
HistoryHabitatrelateMods.RandomCreator(f),
HistoryHabitatrelateMods.RandomEditdate(f),
HistoryHabitatrelateMods.RandomEditor(f),
HistoryHabitatrelateMods.RandomForeignID(f),
HistoryHabitatrelateMods.RandomGlobalid(f),
HistoryHabitatrelateMods.RandomHabitattype(f),
HistoryHabitatrelateMods.RandomObjectid(f),
HistoryHabitatrelateMods.RandomCreatedDate(f),
HistoryHabitatrelateMods.RandomCreatedUser(f),
HistoryHabitatrelateMods.RandomGeometryX(f),
HistoryHabitatrelateMods.RandomGeometryY(f),
HistoryHabitatrelateMods.RandomLastEditedDate(f),
HistoryHabitatrelateMods.RandomLastEditedUser(f),
HistoryHabitatrelateMods.RandomVersion(f),
}
}
// Set the model columns to this value
func (m historyHabitatrelateMods) OrganizationID(val null.Val[int32]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetOrganizationID() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = 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 historyHabitatrelateMods) RandomOrganizationID(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(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 historyHabitatrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyHabitatrelateMods) Creationdate(val null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Creationdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Creationdate = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetCreationdate() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreationdate(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreationdateNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) Creator(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Creator = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) CreatorFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Creator = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetCreator() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreator(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreatorNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) Editdate(val null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Editdate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Editdate = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetEditdate() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomEditdate(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomEditdateNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) Editor(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Editor = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) EditorFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Editor = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetEditor() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomEditor(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomEditorNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) ForeignID(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.ForeignID = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) ForeignIDFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.ForeignID = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetForeignID() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.ForeignID = 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 historyHabitatrelateMods) RandomForeignID(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.ForeignID = 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 historyHabitatrelateMods) RandomForeignIDNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.ForeignID = 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 historyHabitatrelateMods) Globalid(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Globalid = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Globalid = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetGlobalid() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGlobalid(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGlobalidNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) Habitattype(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Habitattype = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Habitattype = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetHabitattype() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Habitattype = 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 historyHabitatrelateMods) RandomHabitattype(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Habitattype = 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 historyHabitatrelateMods) RandomHabitattypeNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Habitattype = 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 historyHabitatrelateMods) Objectid(val int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Objectid = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) ObjectidFunc(f func() int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Objectid = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetObjectid() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomObjectid(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Objectid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m historyHabitatrelateMods) CreatedDate(val null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.CreatedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.CreatedDate = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetCreatedDate() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreatedDate(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) CreatedUser(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.CreatedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.CreatedUser = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetCreatedUser() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreatedUser(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) GeometryX(val null.Val[float64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.GeometryX = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetGeometryX() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGeometryX(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGeometryXNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) GeometryY(val null.Val[float64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.GeometryY = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetGeometryY() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGeometryY(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomGeometryYNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) LastEditedDate(val null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.LastEditedDate = func() null.Val[int64] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.LastEditedDate = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetLastEditedDate() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomLastEditedDate(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) LastEditedUser(val null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.LastEditedUser = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.LastEditedUser = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetLastEditedUser() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomLastEditedUser(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) Version(val int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Version = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) VersionFunc(f func() int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Version = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetVersion() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
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 historyHabitatrelateMods) RandomVersion(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Version = func() int32 {
return random_int32(f)
}
})
}
func (m historyHabitatrelateMods) WithParentsCascading() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) {
if isDone, _ := historyHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = historyHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m historyHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) {
o.r.Organization = &historyHabitatrelateROrganizationR{
o: rel,
}
})
}
func (m historyHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m historyHabitatrelateMods) WithExistingOrganization(em *models.Organization) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) {
o.r.Organization = &historyHabitatrelateROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m historyHabitatrelateMods) WithoutOrganization() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) {
o.r.Organization = nil
})
}