nidus-sync/factory/fs_locationtracking.bob.go

1201 lines
37 KiB
Go
Raw Normal View History

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