nidus-sync/db/factory/raster_overviews.bob.go
Eli Ribble 41587c3694
Move database logic into separate subdirectory
I'm trying to see if this speeds up builds a bit. May not without a
module boundary, but for now it's nice organization to have as the
program grows.
2025-11-24 18:08:31 +00:00

616 lines
19 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"
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/aarondl/opt/null"
"github.com/jaswdr/faker/v2"
)
type RasterOverviewMod interface {
Apply(context.Context, *RasterOverviewTemplate)
}
type RasterOverviewModFunc func(context.Context, *RasterOverviewTemplate)
func (f RasterOverviewModFunc) Apply(ctx context.Context, n *RasterOverviewTemplate) {
f(ctx, n)
}
type RasterOverviewModSlice []RasterOverviewMod
func (mods RasterOverviewModSlice) Apply(ctx context.Context, n *RasterOverviewTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// RasterOverviewTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type RasterOverviewTemplate struct {
OTableCatalog func() null.Val[string]
OTableSchema func() null.Val[string]
OTableName func() null.Val[string]
ORasterColumn func() null.Val[string]
RTableCatalog func() null.Val[string]
RTableSchema func() null.Val[string]
RTableName func() null.Val[string]
RRasterColumn func() null.Val[string]
OverviewFactor func() null.Val[int32]
f *Factory
alreadyPersisted bool
}
// Apply mods to the RasterOverviewTemplate
func (o *RasterOverviewTemplate) Apply(ctx context.Context, mods ...RasterOverviewMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.RasterOverview
// according to the relationships in the template. Nothing is inserted into the db
func (t RasterOverviewTemplate) setModelRels(o *models.RasterOverview) {}
// Build returns an *models.RasterOverview
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use RasterOverviewTemplate.Create
func (o RasterOverviewTemplate) Build() *models.RasterOverview {
m := &models.RasterOverview{}
if o.OTableCatalog != nil {
m.OTableCatalog = o.OTableCatalog()
}
if o.OTableSchema != nil {
m.OTableSchema = o.OTableSchema()
}
if o.OTableName != nil {
m.OTableName = o.OTableName()
}
if o.ORasterColumn != nil {
m.ORasterColumn = o.ORasterColumn()
}
if o.RTableCatalog != nil {
m.RTableCatalog = o.RTableCatalog()
}
if o.RTableSchema != nil {
m.RTableSchema = o.RTableSchema()
}
if o.RTableName != nil {
m.RTableName = o.RTableName()
}
if o.RRasterColumn != nil {
m.RRasterColumn = o.RRasterColumn()
}
if o.OverviewFactor != nil {
m.OverviewFactor = o.OverviewFactor()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.RasterOverviewSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use RasterOverviewTemplate.CreateMany
func (o RasterOverviewTemplate) BuildMany(number int) models.RasterOverviewSlice {
m := make(models.RasterOverviewSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
// RasterOverview has methods that act as mods for the RasterOverviewTemplate
var RasterOverviewMods rasterOverviewMods
type rasterOverviewMods struct{}
func (m rasterOverviewMods) RandomizeAllColumns(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModSlice{
RasterOverviewMods.RandomOTableCatalog(f),
RasterOverviewMods.RandomOTableSchema(f),
RasterOverviewMods.RandomOTableName(f),
RasterOverviewMods.RandomORasterColumn(f),
RasterOverviewMods.RandomRTableCatalog(f),
RasterOverviewMods.RandomRTableSchema(f),
RasterOverviewMods.RandomRTableName(f),
RasterOverviewMods.RandomRRasterColumn(f),
RasterOverviewMods.RandomOverviewFactor(f),
}
}
// Set the model columns to this value
func (m rasterOverviewMods) OTableCatalog(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableCatalog = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) OTableCatalogFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableCatalog = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetOTableCatalog() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableCatalog = 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 rasterOverviewMods) RandomOTableCatalog(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableCatalog = 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 rasterOverviewMods) RandomOTableCatalogNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableCatalog = 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 rasterOverviewMods) OTableSchema(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableSchema = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) OTableSchemaFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableSchema = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetOTableSchema() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableSchema = 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 rasterOverviewMods) RandomOTableSchema(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableSchema = 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 rasterOverviewMods) RandomOTableSchemaNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableSchema = 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 rasterOverviewMods) OTableName(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableName = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) OTableNameFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableName = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetOTableName() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableName = 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 rasterOverviewMods) RandomOTableName(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableName = 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 rasterOverviewMods) RandomOTableNameNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OTableName = 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 rasterOverviewMods) ORasterColumn(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.ORasterColumn = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) ORasterColumnFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.ORasterColumn = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetORasterColumn() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.ORasterColumn = 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 rasterOverviewMods) RandomORasterColumn(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.ORasterColumn = 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 rasterOverviewMods) RandomORasterColumnNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.ORasterColumn = 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 rasterOverviewMods) RTableCatalog(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableCatalog = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) RTableCatalogFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableCatalog = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetRTableCatalog() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableCatalog = 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 rasterOverviewMods) RandomRTableCatalog(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableCatalog = 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 rasterOverviewMods) RandomRTableCatalogNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableCatalog = 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 rasterOverviewMods) RTableSchema(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableSchema = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) RTableSchemaFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableSchema = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetRTableSchema() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableSchema = 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 rasterOverviewMods) RandomRTableSchema(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableSchema = 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 rasterOverviewMods) RandomRTableSchemaNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableSchema = 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 rasterOverviewMods) RTableName(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableName = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) RTableNameFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableName = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetRTableName() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableName = 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 rasterOverviewMods) RandomRTableName(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableName = 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 rasterOverviewMods) RandomRTableNameNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RTableName = 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 rasterOverviewMods) RRasterColumn(val null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RRasterColumn = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) RRasterColumnFunc(f func() null.Val[string]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RRasterColumn = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetRRasterColumn() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RRasterColumn = 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 rasterOverviewMods) RandomRRasterColumn(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RRasterColumn = 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 rasterOverviewMods) RandomRRasterColumnNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.RRasterColumn = 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 rasterOverviewMods) OverviewFactor(val null.Val[int32]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OverviewFactor = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m rasterOverviewMods) OverviewFactorFunc(f func() null.Val[int32]) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OverviewFactor = f
})
}
// Clear any values for the column
func (m rasterOverviewMods) UnsetOverviewFactor() RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OverviewFactor = 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 rasterOverviewMods) RandomOverviewFactor(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OverviewFactor = 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 rasterOverviewMods) RandomOverviewFactorNotNull(f *faker.Faker) RasterOverviewMod {
return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) {
o.OverviewFactor = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
func (m rasterOverviewMods) WithParentsCascading() RasterOverviewMod {
return RasterOverviewModFunc(func(ctx context.Context, o *RasterOverviewTemplate) {
if isDone, _ := rasterOverviewWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = rasterOverviewWithParentsCascadingCtx.WithValue(ctx, true)
})
}