We need the org ID so that we can avoid bleedover between different organizations.
1408 lines
40 KiB
Go
1408 lines
40 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 HistoryZoneMod interface {
|
|
Apply(context.Context, *HistoryZoneTemplate)
|
|
}
|
|
|
|
type HistoryZoneModFunc func(context.Context, *HistoryZoneTemplate)
|
|
|
|
func (f HistoryZoneModFunc) Apply(ctx context.Context, n *HistoryZoneTemplate) {
|
|
f(ctx, n)
|
|
}
|
|
|
|
type HistoryZoneModSlice []HistoryZoneMod
|
|
|
|
func (mods HistoryZoneModSlice) Apply(ctx context.Context, n *HistoryZoneTemplate) {
|
|
for _, f := range mods {
|
|
f.Apply(ctx, n)
|
|
}
|
|
}
|
|
|
|
// HistoryZoneTemplate is an object representing the database table.
|
|
// all columns are optional and should be set by mods
|
|
type HistoryZoneTemplate 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]
|
|
Created func() null.Val[time.Time]
|
|
CreatedDate func() null.Val[int64]
|
|
CreatedUser func() null.Val[string]
|
|
GeometryX func() null.Val[float64]
|
|
GeometryY func() null.Val[float64]
|
|
LastEditedDate func() null.Val[int64]
|
|
LastEditedUser func() null.Val[string]
|
|
Version func() int32
|
|
|
|
r historyZoneR
|
|
f *Factory
|
|
|
|
alreadyPersisted bool
|
|
}
|
|
|
|
type historyZoneR struct {
|
|
Organization *historyZoneROrganizationR
|
|
}
|
|
|
|
type historyZoneROrganizationR struct {
|
|
o *OrganizationTemplate
|
|
}
|
|
|
|
// Apply mods to the HistoryZoneTemplate
|
|
func (o *HistoryZoneTemplate) Apply(ctx context.Context, mods ...HistoryZoneMod) {
|
|
for _, mod := range mods {
|
|
mod.Apply(ctx, o)
|
|
}
|
|
}
|
|
|
|
// setModelRels creates and sets the relationships on *models.HistoryZone
|
|
// according to the relationships in the template. Nothing is inserted into the db
|
|
func (t HistoryZoneTemplate) setModelRels(o *models.HistoryZone) {
|
|
if t.r.Organization != nil {
|
|
rel := t.r.Organization.o.Build()
|
|
rel.R.HistoryZones = append(rel.R.HistoryZones, o)
|
|
o.OrganizationID = rel.ID // h2
|
|
o.R.Organization = rel
|
|
}
|
|
}
|
|
|
|
// BuildSetter returns an *models.HistoryZoneSetter
|
|
// this does nothing with the relationship templates
|
|
func (o HistoryZoneTemplate) BuildSetter() *models.HistoryZoneSetter {
|
|
m := &models.HistoryZoneSetter{}
|
|
|
|
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.Created != nil {
|
|
val := o.Created()
|
|
m.Created = omitnull.FromNull(val)
|
|
}
|
|
if o.CreatedDate != nil {
|
|
val := o.CreatedDate()
|
|
m.CreatedDate = omitnull.FromNull(val)
|
|
}
|
|
if o.CreatedUser != nil {
|
|
val := o.CreatedUser()
|
|
m.CreatedUser = omitnull.FromNull(val)
|
|
}
|
|
if o.GeometryX != nil {
|
|
val := o.GeometryX()
|
|
m.GeometryX = omitnull.FromNull(val)
|
|
}
|
|
if o.GeometryY != nil {
|
|
val := o.GeometryY()
|
|
m.GeometryY = omitnull.FromNull(val)
|
|
}
|
|
if o.LastEditedDate != nil {
|
|
val := o.LastEditedDate()
|
|
m.LastEditedDate = omitnull.FromNull(val)
|
|
}
|
|
if o.LastEditedUser != nil {
|
|
val := o.LastEditedUser()
|
|
m.LastEditedUser = omitnull.FromNull(val)
|
|
}
|
|
if o.Version != nil {
|
|
val := o.Version()
|
|
m.Version = omit.From(val)
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildManySetter returns an []*models.HistoryZoneSetter
|
|
// this does nothing with the relationship templates
|
|
func (o HistoryZoneTemplate) BuildManySetter(number int) []*models.HistoryZoneSetter {
|
|
m := make([]*models.HistoryZoneSetter, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.BuildSetter()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// Build returns an *models.HistoryZone
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.Create
|
|
func (o HistoryZoneTemplate) Build() *models.HistoryZone {
|
|
m := &models.HistoryZone{}
|
|
|
|
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.Created != nil {
|
|
m.Created = o.Created()
|
|
}
|
|
if o.CreatedDate != nil {
|
|
m.CreatedDate = o.CreatedDate()
|
|
}
|
|
if o.CreatedUser != nil {
|
|
m.CreatedUser = o.CreatedUser()
|
|
}
|
|
if o.GeometryX != nil {
|
|
m.GeometryX = o.GeometryX()
|
|
}
|
|
if o.GeometryY != nil {
|
|
m.GeometryY = o.GeometryY()
|
|
}
|
|
if o.LastEditedDate != nil {
|
|
m.LastEditedDate = o.LastEditedDate()
|
|
}
|
|
if o.LastEditedUser != nil {
|
|
m.LastEditedUser = o.LastEditedUser()
|
|
}
|
|
if o.Version != nil {
|
|
m.Version = o.Version()
|
|
}
|
|
|
|
o.setModelRels(m)
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildMany returns an models.HistoryZoneSlice
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.CreateMany
|
|
func (o HistoryZoneTemplate) BuildMany(number int) models.HistoryZoneSlice {
|
|
m := make(models.HistoryZoneSlice, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.Build()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func ensureCreatableHistoryZone(m *models.HistoryZoneSetter) {
|
|
if !(m.OrganizationID.IsValue()) {
|
|
val := random_int32(nil)
|
|
m.OrganizationID = omit.From(val)
|
|
}
|
|
if !(m.Objectid.IsValue()) {
|
|
val := random_int32(nil)
|
|
m.Objectid = omit.From(val)
|
|
}
|
|
if !(m.Version.IsValue()) {
|
|
val := random_int32(nil)
|
|
m.Version = omit.From(val)
|
|
}
|
|
}
|
|
|
|
// insertOptRels creates and inserts any optional the relationships on *models.HistoryZone
|
|
// according to the relationships in the template.
|
|
// any required relationship should have already exist on the model
|
|
func (o *HistoryZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryZone) error {
|
|
var err error
|
|
|
|
return err
|
|
}
|
|
|
|
// Create builds a historyZone and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o *HistoryZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryZone, error) {
|
|
var err error
|
|
opt := o.BuildSetter()
|
|
ensureCreatableHistoryZone(opt)
|
|
|
|
if o.r.Organization == nil {
|
|
HistoryZoneMods.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.HistoryZones.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 historyZone and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o *HistoryZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryZone {
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateOrFail builds a historyZone 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 *HistoryZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryZone {
|
|
tb.Helper()
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateMany builds multiple historyZones and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o HistoryZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryZoneSlice, error) {
|
|
var err error
|
|
m := make(models.HistoryZoneSlice, number)
|
|
|
|
for i := range m {
|
|
m[i], err = o.Create(ctx, exec)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return m, nil
|
|
}
|
|
|
|
// MustCreateMany builds multiple historyZones and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o HistoryZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryZoneSlice {
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateManyOrFail builds multiple historyZones 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 HistoryZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryZoneSlice {
|
|
tb.Helper()
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// HistoryZone has methods that act as mods for the HistoryZoneTemplate
|
|
var HistoryZoneMods historyZoneMods
|
|
|
|
type historyZoneMods struct{}
|
|
|
|
func (m historyZoneMods) RandomizeAllColumns(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModSlice{
|
|
HistoryZoneMods.RandomOrganizationID(f),
|
|
HistoryZoneMods.RandomActive(f),
|
|
HistoryZoneMods.RandomCreationdate(f),
|
|
HistoryZoneMods.RandomCreator(f),
|
|
HistoryZoneMods.RandomEditdate(f),
|
|
HistoryZoneMods.RandomEditor(f),
|
|
HistoryZoneMods.RandomGlobalid(f),
|
|
HistoryZoneMods.RandomName(f),
|
|
HistoryZoneMods.RandomObjectid(f),
|
|
HistoryZoneMods.RandomShapeArea(f),
|
|
HistoryZoneMods.RandomShapeLength(f),
|
|
HistoryZoneMods.RandomCreated(f),
|
|
HistoryZoneMods.RandomCreatedDate(f),
|
|
HistoryZoneMods.RandomCreatedUser(f),
|
|
HistoryZoneMods.RandomGeometryX(f),
|
|
HistoryZoneMods.RandomGeometryY(f),
|
|
HistoryZoneMods.RandomLastEditedDate(f),
|
|
HistoryZoneMods.RandomLastEditedUser(f),
|
|
HistoryZoneMods.RandomVersion(f),
|
|
}
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m historyZoneMods) OrganizationID(val int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.OrganizationID = func() int32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) OrganizationIDFunc(f func() int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.OrganizationID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetOrganizationID() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomOrganizationID(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.OrganizationID = func() int32 {
|
|
return random_int32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m historyZoneMods) Active(val null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Active = func() null.Val[int64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) ActiveFunc(f func() null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Active = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetActive() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomActive(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomActiveNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Creationdate(val null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Creationdate = func() null.Val[int64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) CreationdateFunc(f func() null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Creationdate = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetCreationdate() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreationdate(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreationdateNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Creator(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Creator = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) CreatorFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Creator = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetCreator() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreator(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreatorNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Editdate(val null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Editdate = func() null.Val[int64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) EditdateFunc(f func() null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Editdate = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetEditdate() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomEditdate(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomEditdateNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Editor(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Editor = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) EditorFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Editor = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetEditor() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomEditor(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomEditorNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Globalid(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Globalid = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) GlobalidFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Globalid = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetGlobalid() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGlobalid(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGlobalidNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Name(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Name = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) NameFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Name = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetName() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomName(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomNameNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Objectid(val int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Objectid = func() int32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) ObjectidFunc(f func() int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Objectid = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetObjectid() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomObjectid(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Objectid = func() int32 {
|
|
return random_int32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m historyZoneMods) ShapeArea(val null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.ShapeArea = func() null.Val[float64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.ShapeArea = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetShapeArea() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomShapeArea(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomShapeAreaNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) ShapeLength(val null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.ShapeLength = func() null.Val[float64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.ShapeLength = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetShapeLength() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomShapeLength(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Created(val null.Val[time.Time]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Created = func() null.Val[time.Time] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) CreatedFunc(f func() null.Val[time.Time]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Created = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetCreated() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Created = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m historyZoneMods) RandomCreated(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Created = func() null.Val[time.Time] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_time_Time(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m historyZoneMods) RandomCreatedNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Created = func() null.Val[time.Time] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_time_Time(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m historyZoneMods) CreatedDate(val null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.CreatedDate = func() null.Val[int64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) CreatedDateFunc(f func() null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.CreatedDate = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetCreatedDate() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreatedDate(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) CreatedUser(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.CreatedUser = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) CreatedUserFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.CreatedUser = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetCreatedUser() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreatedUser(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) GeometryX(val null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.GeometryX = func() null.Val[float64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) GeometryXFunc(f func() null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.GeometryX = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetGeometryX() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGeometryX(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGeometryXNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) GeometryY(val null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.GeometryY = func() null.Val[float64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) GeometryYFunc(f func() null.Val[float64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.GeometryY = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetGeometryY() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGeometryY(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomGeometryYNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) LastEditedDate(val null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.LastEditedDate = func() null.Val[int64] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.LastEditedDate = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetLastEditedDate() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomLastEditedDate(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) LastEditedUser(val null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.LastEditedUser = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) LastEditedUserFunc(f func() null.Val[string]) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.LastEditedUser = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetLastEditedUser() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomLastEditedUser(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) Version(val int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Version = func() int32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m historyZoneMods) VersionFunc(f func() int32) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Version = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m historyZoneMods) UnsetVersion() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
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 historyZoneMods) RandomVersion(f *faker.Faker) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) {
|
|
o.Version = func() int32 {
|
|
return random_int32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m historyZoneMods) WithParentsCascading() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) {
|
|
if isDone, _ := historyZoneWithParentsCascadingCtx.Value(ctx); isDone {
|
|
return
|
|
}
|
|
ctx = historyZoneWithParentsCascadingCtx.WithValue(ctx, true)
|
|
{
|
|
|
|
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
|
|
m.WithOrganization(related).Apply(ctx, o)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m historyZoneMods) WithOrganization(rel *OrganizationTemplate) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) {
|
|
o.r.Organization = &historyZoneROrganizationR{
|
|
o: rel,
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m historyZoneMods) WithNewOrganization(mods ...OrganizationMod) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) {
|
|
related := o.f.NewOrganizationWithContext(ctx, mods...)
|
|
|
|
m.WithOrganization(related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m historyZoneMods) WithExistingOrganization(em *models.Organization) HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) {
|
|
o.r.Organization = &historyZoneROrganizationR{
|
|
o: o.f.FromExistingOrganization(em),
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m historyZoneMods) WithoutOrganization() HistoryZoneMod {
|
|
return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) {
|
|
o.r.Organization = nil
|
|
})
|
|
}
|