2106 lines
66 KiB
Go
2106 lines
66 KiB
Go
// Code generated by BobGen psql v0.42.5. 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"
|
|
|
|
"github.com/Gleipnir-Technology/bob"
|
|
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
|
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
|
|
"github.com/aarondl/opt/null"
|
|
"github.com/aarondl/opt/omit"
|
|
"github.com/aarondl/opt/omitnull"
|
|
"github.com/jaswdr/faker/v2"
|
|
)
|
|
|
|
type PublicreportPoolMod interface {
|
|
Apply(context.Context, *PublicreportPoolTemplate)
|
|
}
|
|
|
|
type PublicreportPoolModFunc func(context.Context, *PublicreportPoolTemplate)
|
|
|
|
func (f PublicreportPoolModFunc) Apply(ctx context.Context, n *PublicreportPoolTemplate) {
|
|
f(ctx, n)
|
|
}
|
|
|
|
type PublicreportPoolModSlice []PublicreportPoolMod
|
|
|
|
func (mods PublicreportPoolModSlice) Apply(ctx context.Context, n *PublicreportPoolTemplate) {
|
|
for _, f := range mods {
|
|
f.Apply(ctx, n)
|
|
}
|
|
}
|
|
|
|
// PublicreportPoolTemplate is an object representing the database table.
|
|
// all columns are optional and should be set by mods
|
|
type PublicreportPoolTemplate struct {
|
|
ID func() int32
|
|
AccessComments func() string
|
|
AccessGate func() bool
|
|
AccessFence func() bool
|
|
AccessLocked func() bool
|
|
AccessDog func() bool
|
|
AccessOther func() bool
|
|
Address func() string
|
|
AddressCountry func() string
|
|
AddressPostCode func() string
|
|
AddressPlace func() string
|
|
AddressStreet func() string
|
|
AddressRegion func() string
|
|
Comments func() string
|
|
Created func() time.Time
|
|
H3cell func() null.Val[string]
|
|
HasAdult func() bool
|
|
HasLarvae func() bool
|
|
HasPupae func() bool
|
|
Location func() null.Val[string]
|
|
MapZoom func() float32
|
|
OwnerEmail func() string
|
|
OwnerName func() string
|
|
OwnerPhone func() string
|
|
PublicID func() string
|
|
ReporterEmail func() string
|
|
ReporterName func() string
|
|
ReporterPhone func() string
|
|
Status func() enums.PublicreportReportstatustype
|
|
OrganizationID func() null.Val[int32]
|
|
HasBackyardPermission func() bool
|
|
IsReporterConfidential func() bool
|
|
IsReporterOwner func() bool
|
|
ReporterContactConsent func() null.Val[bool]
|
|
|
|
r publicreportPoolR
|
|
f *Factory
|
|
|
|
alreadyPersisted bool
|
|
}
|
|
|
|
type publicreportPoolR struct {
|
|
NotifyEmailPools []*publicreportPoolRNotifyEmailPoolsR
|
|
NotifyPhonePools []*publicreportPoolRNotifyPhonePoolsR
|
|
Organization *publicreportPoolROrganizationR
|
|
Images []*publicreportPoolRImagesR
|
|
}
|
|
|
|
type publicreportPoolRNotifyEmailPoolsR struct {
|
|
number int
|
|
o *PublicreportNotifyEmailPoolTemplate
|
|
}
|
|
type publicreportPoolRNotifyPhonePoolsR struct {
|
|
number int
|
|
o *PublicreportNotifyPhonePoolTemplate
|
|
}
|
|
type publicreportPoolROrganizationR struct {
|
|
o *OrganizationTemplate
|
|
}
|
|
type publicreportPoolRImagesR struct {
|
|
number int
|
|
o *PublicreportImageTemplate
|
|
}
|
|
|
|
// Apply mods to the PublicreportPoolTemplate
|
|
func (o *PublicreportPoolTemplate) Apply(ctx context.Context, mods ...PublicreportPoolMod) {
|
|
for _, mod := range mods {
|
|
mod.Apply(ctx, o)
|
|
}
|
|
}
|
|
|
|
// setModelRels creates and sets the relationships on *models.PublicreportPool
|
|
// according to the relationships in the template. Nothing is inserted into the db
|
|
func (t PublicreportPoolTemplate) setModelRels(o *models.PublicreportPool) {
|
|
if t.r.NotifyEmailPools != nil {
|
|
rel := models.PublicreportNotifyEmailPoolSlice{}
|
|
for _, r := range t.r.NotifyEmailPools {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.PoolID = o.ID // h2
|
|
rel.R.Pool = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.NotifyEmailPools = rel
|
|
}
|
|
|
|
if t.r.NotifyPhonePools != nil {
|
|
rel := models.PublicreportNotifyPhonePoolSlice{}
|
|
for _, r := range t.r.NotifyPhonePools {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.PoolID = o.ID // h2
|
|
rel.R.Pool = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.NotifyPhonePools = rel
|
|
}
|
|
|
|
if t.r.Organization != nil {
|
|
rel := t.r.Organization.o.Build()
|
|
rel.R.PublicreportPool = append(rel.R.PublicreportPool, o)
|
|
o.OrganizationID = null.From(rel.ID) // h2
|
|
o.R.Organization = rel
|
|
}
|
|
|
|
if t.r.Images != nil {
|
|
rel := models.PublicreportImageSlice{}
|
|
for _, r := range t.r.Images {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.R.Pools = append(rel.R.Pools, o)
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Images = rel
|
|
}
|
|
}
|
|
|
|
// BuildSetter returns an *models.PublicreportPoolSetter
|
|
// this does nothing with the relationship templates
|
|
func (o PublicreportPoolTemplate) BuildSetter() *models.PublicreportPoolSetter {
|
|
m := &models.PublicreportPoolSetter{}
|
|
|
|
if o.ID != nil {
|
|
val := o.ID()
|
|
m.ID = omit.From(val)
|
|
}
|
|
if o.AccessComments != nil {
|
|
val := o.AccessComments()
|
|
m.AccessComments = omit.From(val)
|
|
}
|
|
if o.AccessGate != nil {
|
|
val := o.AccessGate()
|
|
m.AccessGate = omit.From(val)
|
|
}
|
|
if o.AccessFence != nil {
|
|
val := o.AccessFence()
|
|
m.AccessFence = omit.From(val)
|
|
}
|
|
if o.AccessLocked != nil {
|
|
val := o.AccessLocked()
|
|
m.AccessLocked = omit.From(val)
|
|
}
|
|
if o.AccessDog != nil {
|
|
val := o.AccessDog()
|
|
m.AccessDog = omit.From(val)
|
|
}
|
|
if o.AccessOther != nil {
|
|
val := o.AccessOther()
|
|
m.AccessOther = omit.From(val)
|
|
}
|
|
if o.Address != nil {
|
|
val := o.Address()
|
|
m.Address = omit.From(val)
|
|
}
|
|
if o.AddressCountry != nil {
|
|
val := o.AddressCountry()
|
|
m.AddressCountry = omit.From(val)
|
|
}
|
|
if o.AddressPostCode != nil {
|
|
val := o.AddressPostCode()
|
|
m.AddressPostCode = omit.From(val)
|
|
}
|
|
if o.AddressPlace != nil {
|
|
val := o.AddressPlace()
|
|
m.AddressPlace = omit.From(val)
|
|
}
|
|
if o.AddressStreet != nil {
|
|
val := o.AddressStreet()
|
|
m.AddressStreet = omit.From(val)
|
|
}
|
|
if o.AddressRegion != nil {
|
|
val := o.AddressRegion()
|
|
m.AddressRegion = omit.From(val)
|
|
}
|
|
if o.Comments != nil {
|
|
val := o.Comments()
|
|
m.Comments = omit.From(val)
|
|
}
|
|
if o.Created != nil {
|
|
val := o.Created()
|
|
m.Created = omit.From(val)
|
|
}
|
|
if o.H3cell != nil {
|
|
val := o.H3cell()
|
|
m.H3cell = omitnull.FromNull(val)
|
|
}
|
|
if o.HasAdult != nil {
|
|
val := o.HasAdult()
|
|
m.HasAdult = omit.From(val)
|
|
}
|
|
if o.HasLarvae != nil {
|
|
val := o.HasLarvae()
|
|
m.HasLarvae = omit.From(val)
|
|
}
|
|
if o.HasPupae != nil {
|
|
val := o.HasPupae()
|
|
m.HasPupae = omit.From(val)
|
|
}
|
|
if o.Location != nil {
|
|
val := o.Location()
|
|
m.Location = omitnull.FromNull(val)
|
|
}
|
|
if o.MapZoom != nil {
|
|
val := o.MapZoom()
|
|
m.MapZoom = omit.From(val)
|
|
}
|
|
if o.OwnerEmail != nil {
|
|
val := o.OwnerEmail()
|
|
m.OwnerEmail = omit.From(val)
|
|
}
|
|
if o.OwnerName != nil {
|
|
val := o.OwnerName()
|
|
m.OwnerName = omit.From(val)
|
|
}
|
|
if o.OwnerPhone != nil {
|
|
val := o.OwnerPhone()
|
|
m.OwnerPhone = omit.From(val)
|
|
}
|
|
if o.PublicID != nil {
|
|
val := o.PublicID()
|
|
m.PublicID = omit.From(val)
|
|
}
|
|
if o.ReporterEmail != nil {
|
|
val := o.ReporterEmail()
|
|
m.ReporterEmail = omit.From(val)
|
|
}
|
|
if o.ReporterName != nil {
|
|
val := o.ReporterName()
|
|
m.ReporterName = omit.From(val)
|
|
}
|
|
if o.ReporterPhone != nil {
|
|
val := o.ReporterPhone()
|
|
m.ReporterPhone = omit.From(val)
|
|
}
|
|
if o.Status != nil {
|
|
val := o.Status()
|
|
m.Status = omit.From(val)
|
|
}
|
|
if o.OrganizationID != nil {
|
|
val := o.OrganizationID()
|
|
m.OrganizationID = omitnull.FromNull(val)
|
|
}
|
|
if o.HasBackyardPermission != nil {
|
|
val := o.HasBackyardPermission()
|
|
m.HasBackyardPermission = omit.From(val)
|
|
}
|
|
if o.IsReporterConfidential != nil {
|
|
val := o.IsReporterConfidential()
|
|
m.IsReporterConfidential = omit.From(val)
|
|
}
|
|
if o.IsReporterOwner != nil {
|
|
val := o.IsReporterOwner()
|
|
m.IsReporterOwner = omit.From(val)
|
|
}
|
|
if o.ReporterContactConsent != nil {
|
|
val := o.ReporterContactConsent()
|
|
m.ReporterContactConsent = omitnull.FromNull(val)
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildManySetter returns an []*models.PublicreportPoolSetter
|
|
// this does nothing with the relationship templates
|
|
func (o PublicreportPoolTemplate) BuildManySetter(number int) []*models.PublicreportPoolSetter {
|
|
m := make([]*models.PublicreportPoolSetter, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.BuildSetter()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// Build returns an *models.PublicreportPool
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use PublicreportPoolTemplate.Create
|
|
func (o PublicreportPoolTemplate) Build() *models.PublicreportPool {
|
|
m := &models.PublicreportPool{}
|
|
|
|
if o.ID != nil {
|
|
m.ID = o.ID()
|
|
}
|
|
if o.AccessComments != nil {
|
|
m.AccessComments = o.AccessComments()
|
|
}
|
|
if o.AccessGate != nil {
|
|
m.AccessGate = o.AccessGate()
|
|
}
|
|
if o.AccessFence != nil {
|
|
m.AccessFence = o.AccessFence()
|
|
}
|
|
if o.AccessLocked != nil {
|
|
m.AccessLocked = o.AccessLocked()
|
|
}
|
|
if o.AccessDog != nil {
|
|
m.AccessDog = o.AccessDog()
|
|
}
|
|
if o.AccessOther != nil {
|
|
m.AccessOther = o.AccessOther()
|
|
}
|
|
if o.Address != nil {
|
|
m.Address = o.Address()
|
|
}
|
|
if o.AddressCountry != nil {
|
|
m.AddressCountry = o.AddressCountry()
|
|
}
|
|
if o.AddressPostCode != nil {
|
|
m.AddressPostCode = o.AddressPostCode()
|
|
}
|
|
if o.AddressPlace != nil {
|
|
m.AddressPlace = o.AddressPlace()
|
|
}
|
|
if o.AddressStreet != nil {
|
|
m.AddressStreet = o.AddressStreet()
|
|
}
|
|
if o.AddressRegion != nil {
|
|
m.AddressRegion = o.AddressRegion()
|
|
}
|
|
if o.Comments != nil {
|
|
m.Comments = o.Comments()
|
|
}
|
|
if o.Created != nil {
|
|
m.Created = o.Created()
|
|
}
|
|
if o.H3cell != nil {
|
|
m.H3cell = o.H3cell()
|
|
}
|
|
if o.HasAdult != nil {
|
|
m.HasAdult = o.HasAdult()
|
|
}
|
|
if o.HasLarvae != nil {
|
|
m.HasLarvae = o.HasLarvae()
|
|
}
|
|
if o.HasPupae != nil {
|
|
m.HasPupae = o.HasPupae()
|
|
}
|
|
if o.Location != nil {
|
|
m.Location = o.Location()
|
|
}
|
|
if o.MapZoom != nil {
|
|
m.MapZoom = o.MapZoom()
|
|
}
|
|
if o.OwnerEmail != nil {
|
|
m.OwnerEmail = o.OwnerEmail()
|
|
}
|
|
if o.OwnerName != nil {
|
|
m.OwnerName = o.OwnerName()
|
|
}
|
|
if o.OwnerPhone != nil {
|
|
m.OwnerPhone = o.OwnerPhone()
|
|
}
|
|
if o.PublicID != nil {
|
|
m.PublicID = o.PublicID()
|
|
}
|
|
if o.ReporterEmail != nil {
|
|
m.ReporterEmail = o.ReporterEmail()
|
|
}
|
|
if o.ReporterName != nil {
|
|
m.ReporterName = o.ReporterName()
|
|
}
|
|
if o.ReporterPhone != nil {
|
|
m.ReporterPhone = o.ReporterPhone()
|
|
}
|
|
if o.Status != nil {
|
|
m.Status = o.Status()
|
|
}
|
|
if o.OrganizationID != nil {
|
|
m.OrganizationID = o.OrganizationID()
|
|
}
|
|
if o.HasBackyardPermission != nil {
|
|
m.HasBackyardPermission = o.HasBackyardPermission()
|
|
}
|
|
if o.IsReporterConfidential != nil {
|
|
m.IsReporterConfidential = o.IsReporterConfidential()
|
|
}
|
|
if o.IsReporterOwner != nil {
|
|
m.IsReporterOwner = o.IsReporterOwner()
|
|
}
|
|
if o.ReporterContactConsent != nil {
|
|
m.ReporterContactConsent = o.ReporterContactConsent()
|
|
}
|
|
|
|
o.setModelRels(m)
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildMany returns an models.PublicreportPoolSlice
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use PublicreportPoolTemplate.CreateMany
|
|
func (o PublicreportPoolTemplate) BuildMany(number int) models.PublicreportPoolSlice {
|
|
m := make(models.PublicreportPoolSlice, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.Build()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func ensureCreatablePublicreportPool(m *models.PublicreportPoolSetter) {
|
|
if !(m.AccessComments.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AccessComments = omit.From(val)
|
|
}
|
|
if !(m.AccessGate.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.AccessGate = omit.From(val)
|
|
}
|
|
if !(m.AccessFence.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.AccessFence = omit.From(val)
|
|
}
|
|
if !(m.AccessLocked.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.AccessLocked = omit.From(val)
|
|
}
|
|
if !(m.AccessDog.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.AccessDog = omit.From(val)
|
|
}
|
|
if !(m.AccessOther.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.AccessOther = omit.From(val)
|
|
}
|
|
if !(m.Address.IsValue()) {
|
|
val := random_string(nil)
|
|
m.Address = omit.From(val)
|
|
}
|
|
if !(m.AddressCountry.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AddressCountry = omit.From(val)
|
|
}
|
|
if !(m.AddressPostCode.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AddressPostCode = omit.From(val)
|
|
}
|
|
if !(m.AddressPlace.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AddressPlace = omit.From(val)
|
|
}
|
|
if !(m.AddressStreet.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AddressStreet = omit.From(val)
|
|
}
|
|
if !(m.AddressRegion.IsValue()) {
|
|
val := random_string(nil)
|
|
m.AddressRegion = omit.From(val)
|
|
}
|
|
if !(m.Comments.IsValue()) {
|
|
val := random_string(nil)
|
|
m.Comments = omit.From(val)
|
|
}
|
|
if !(m.Created.IsValue()) {
|
|
val := random_time_Time(nil)
|
|
m.Created = omit.From(val)
|
|
}
|
|
if !(m.HasAdult.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.HasAdult = omit.From(val)
|
|
}
|
|
if !(m.HasLarvae.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.HasLarvae = omit.From(val)
|
|
}
|
|
if !(m.HasPupae.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.HasPupae = omit.From(val)
|
|
}
|
|
if !(m.MapZoom.IsValue()) {
|
|
val := random_float32(nil)
|
|
m.MapZoom = omit.From(val)
|
|
}
|
|
if !(m.OwnerEmail.IsValue()) {
|
|
val := random_string(nil)
|
|
m.OwnerEmail = omit.From(val)
|
|
}
|
|
if !(m.OwnerName.IsValue()) {
|
|
val := random_string(nil)
|
|
m.OwnerName = omit.From(val)
|
|
}
|
|
if !(m.OwnerPhone.IsValue()) {
|
|
val := random_string(nil)
|
|
m.OwnerPhone = omit.From(val)
|
|
}
|
|
if !(m.PublicID.IsValue()) {
|
|
val := random_string(nil)
|
|
m.PublicID = omit.From(val)
|
|
}
|
|
if !(m.ReporterEmail.IsValue()) {
|
|
val := random_string(nil)
|
|
m.ReporterEmail = omit.From(val)
|
|
}
|
|
if !(m.ReporterName.IsValue()) {
|
|
val := random_string(nil)
|
|
m.ReporterName = omit.From(val)
|
|
}
|
|
if !(m.ReporterPhone.IsValue()) {
|
|
val := random_string(nil)
|
|
m.ReporterPhone = omit.From(val)
|
|
}
|
|
if !(m.Status.IsValue()) {
|
|
val := random_enums_PublicreportReportstatustype(nil)
|
|
m.Status = omit.From(val)
|
|
}
|
|
if !(m.HasBackyardPermission.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.HasBackyardPermission = omit.From(val)
|
|
}
|
|
if !(m.IsReporterConfidential.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.IsReporterConfidential = omit.From(val)
|
|
}
|
|
if !(m.IsReporterOwner.IsValue()) {
|
|
val := random_bool(nil)
|
|
m.IsReporterOwner = omit.From(val)
|
|
}
|
|
}
|
|
|
|
// insertOptRels creates and inserts any optional the relationships on *models.PublicreportPool
|
|
// according to the relationships in the template.
|
|
// any required relationship should have already exist on the model
|
|
func (o *PublicreportPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportPool) error {
|
|
var err error
|
|
|
|
isNotifyEmailPoolsDone, _ := publicreportPoolRelNotifyEmailPoolsCtx.Value(ctx)
|
|
if !isNotifyEmailPoolsDone && o.r.NotifyEmailPools != nil {
|
|
ctx = publicreportPoolRelNotifyEmailPoolsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.NotifyEmailPools {
|
|
if r.o.alreadyPersisted {
|
|
m.R.NotifyEmailPools = append(m.R.NotifyEmailPools, r.o.Build())
|
|
} else {
|
|
rel0, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachNotifyEmailPools(ctx, exec, rel0...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isNotifyPhonePoolsDone, _ := publicreportPoolRelNotifyPhonePoolsCtx.Value(ctx)
|
|
if !isNotifyPhonePoolsDone && o.r.NotifyPhonePools != nil {
|
|
ctx = publicreportPoolRelNotifyPhonePoolsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.NotifyPhonePools {
|
|
if r.o.alreadyPersisted {
|
|
m.R.NotifyPhonePools = append(m.R.NotifyPhonePools, r.o.Build())
|
|
} else {
|
|
rel1, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachNotifyPhonePools(ctx, exec, rel1...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isOrganizationDone, _ := publicreportPoolRelOrganizationCtx.Value(ctx)
|
|
if !isOrganizationDone && o.r.Organization != nil {
|
|
ctx = publicreportPoolRelOrganizationCtx.WithValue(ctx, true)
|
|
if o.r.Organization.o.alreadyPersisted {
|
|
m.R.Organization = o.r.Organization.o.Build()
|
|
} else {
|
|
var rel2 *models.Organization
|
|
rel2, err = o.r.Organization.o.Create(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = m.AttachOrganization(ctx, exec, rel2)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
isImagesDone, _ := publicreportPoolRelImagesCtx.Value(ctx)
|
|
if !isImagesDone && o.r.Images != nil {
|
|
ctx = publicreportPoolRelImagesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Images {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Images = append(m.R.Images, r.o.Build())
|
|
} else {
|
|
rel3, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachImages(ctx, exec, rel3...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// Create builds a publicreportPool and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o *PublicreportPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportPool, error) {
|
|
var err error
|
|
opt := o.BuildSetter()
|
|
ensureCreatablePublicreportPool(opt)
|
|
|
|
m, err := models.PublicreportPools.Insert(opt).One(ctx, exec)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := o.insertOptRels(ctx, exec, m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, err
|
|
}
|
|
|
|
// MustCreate builds a publicreportPool and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o *PublicreportPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportPool {
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateOrFail builds a publicreportPool 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 *PublicreportPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportPool {
|
|
tb.Helper()
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateMany builds multiple publicreportPools and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o PublicreportPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportPoolSlice, error) {
|
|
var err error
|
|
m := make(models.PublicreportPoolSlice, number)
|
|
|
|
for i := range m {
|
|
m[i], err = o.Create(ctx, exec)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return m, nil
|
|
}
|
|
|
|
// MustCreateMany builds multiple publicreportPools and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o PublicreportPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportPoolSlice {
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateManyOrFail builds multiple publicreportPools 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 PublicreportPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportPoolSlice {
|
|
tb.Helper()
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// PublicreportPool has methods that act as mods for the PublicreportPoolTemplate
|
|
var PublicreportPoolMods publicreportPoolMods
|
|
|
|
type publicreportPoolMods struct{}
|
|
|
|
func (m publicreportPoolMods) RandomizeAllColumns(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModSlice{
|
|
PublicreportPoolMods.RandomID(f),
|
|
PublicreportPoolMods.RandomAccessComments(f),
|
|
PublicreportPoolMods.RandomAccessGate(f),
|
|
PublicreportPoolMods.RandomAccessFence(f),
|
|
PublicreportPoolMods.RandomAccessLocked(f),
|
|
PublicreportPoolMods.RandomAccessDog(f),
|
|
PublicreportPoolMods.RandomAccessOther(f),
|
|
PublicreportPoolMods.RandomAddress(f),
|
|
PublicreportPoolMods.RandomAddressCountry(f),
|
|
PublicreportPoolMods.RandomAddressPostCode(f),
|
|
PublicreportPoolMods.RandomAddressPlace(f),
|
|
PublicreportPoolMods.RandomAddressStreet(f),
|
|
PublicreportPoolMods.RandomAddressRegion(f),
|
|
PublicreportPoolMods.RandomComments(f),
|
|
PublicreportPoolMods.RandomCreated(f),
|
|
PublicreportPoolMods.RandomH3cell(f),
|
|
PublicreportPoolMods.RandomHasAdult(f),
|
|
PublicreportPoolMods.RandomHasLarvae(f),
|
|
PublicreportPoolMods.RandomHasPupae(f),
|
|
PublicreportPoolMods.RandomLocation(f),
|
|
PublicreportPoolMods.RandomMapZoom(f),
|
|
PublicreportPoolMods.RandomOwnerEmail(f),
|
|
PublicreportPoolMods.RandomOwnerName(f),
|
|
PublicreportPoolMods.RandomOwnerPhone(f),
|
|
PublicreportPoolMods.RandomPublicID(f),
|
|
PublicreportPoolMods.RandomReporterEmail(f),
|
|
PublicreportPoolMods.RandomReporterName(f),
|
|
PublicreportPoolMods.RandomReporterPhone(f),
|
|
PublicreportPoolMods.RandomStatus(f),
|
|
PublicreportPoolMods.RandomOrganizationID(f),
|
|
PublicreportPoolMods.RandomHasBackyardPermission(f),
|
|
PublicreportPoolMods.RandomIsReporterConfidential(f),
|
|
PublicreportPoolMods.RandomIsReporterOwner(f),
|
|
PublicreportPoolMods.RandomReporterContactConsent(f),
|
|
}
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) ID(val int32) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ID = func() int32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) IDFunc(f func() int32) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetID() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ID = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomID(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ID = func() int32 {
|
|
return random_int32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessComments(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessComments = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessCommentsFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessComments = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessComments() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessComments = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessComments(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessComments = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessGate(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessGate = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessGateFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessGate = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessGate() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessGate = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessGate(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessGate = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessFence(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessFence = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessFenceFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessFence = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessFence() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessFence = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessFence(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessFence = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessLocked(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessLocked = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessLockedFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessLocked = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessLocked() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessLocked = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessLocked(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessLocked = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessDog(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessDog = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessDogFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessDog = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessDog() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessDog = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessDog(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessDog = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AccessOther(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessOther = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AccessOtherFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessOther = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAccessOther() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessOther = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAccessOther(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AccessOther = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) Address(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Address = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Address = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddress() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Address = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddress(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Address = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AddressCountry(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressCountry = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressCountryFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressCountry = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddressCountry() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressCountry = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddressCountry(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressCountry = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AddressPostCode(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPostCode = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressPostCodeFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPostCode = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddressPostCode() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPostCode = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddressPostCode(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPostCode = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AddressPlace(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPlace = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressPlaceFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPlace = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddressPlace() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPlace = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddressPlace(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressPlace = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AddressStreet(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressStreet = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressStreetFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressStreet = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddressStreet() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressStreet = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddressStreet(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressStreet = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) AddressRegion(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressRegion = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) AddressRegionFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressRegion = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetAddressRegion() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressRegion = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomAddressRegion(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.AddressRegion = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) Comments(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Comments = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) CommentsFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Comments = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetComments() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Comments = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomComments(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Comments = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) Created(val time.Time) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Created = func() time.Time { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) CreatedFunc(f func() time.Time) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Created = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetCreated() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Created = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomCreated(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Created = func() time.Time {
|
|
return random_time_Time(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) H3cell(val null.Val[string]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.H3cell = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) H3cellFunc(f func() null.Val[string]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.H3cell = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetH3cell() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.H3cell = 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 publicreportPoolMods) RandomH3cell(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.H3cell = 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 publicreportPoolMods) RandomH3cellNotNull(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.H3cell = 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 publicreportPoolMods) HasAdult(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasAdult = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) HasAdultFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasAdult = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetHasAdult() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasAdult = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomHasAdult(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasAdult = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) HasLarvae(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasLarvae = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) HasLarvaeFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasLarvae = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetHasLarvae() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasLarvae = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomHasLarvae(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasLarvae = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) HasPupae(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasPupae = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) HasPupaeFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasPupae = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetHasPupae() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasPupae = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomHasPupae(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasPupae = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) Location(val null.Val[string]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Location = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) LocationFunc(f func() null.Val[string]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Location = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetLocation() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Location = 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 publicreportPoolMods) RandomLocation(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Location = 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 publicreportPoolMods) RandomLocationNotNull(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Location = 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 publicreportPoolMods) MapZoom(val float32) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.MapZoom = func() float32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) MapZoomFunc(f func() float32) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.MapZoom = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetMapZoom() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.MapZoom = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomMapZoom(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.MapZoom = func() float32 {
|
|
return random_float32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) OwnerEmail(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerEmail = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) OwnerEmailFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerEmail = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetOwnerEmail() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerEmail = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomOwnerEmail(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerEmail = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) OwnerName(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerName = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) OwnerNameFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerName = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetOwnerName() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerName = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomOwnerName(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerName = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) OwnerPhone(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerPhone = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) OwnerPhoneFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerPhone = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetOwnerPhone() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerPhone = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomOwnerPhone(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OwnerPhone = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) PublicID(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.PublicID = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) PublicIDFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.PublicID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetPublicID() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.PublicID = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomPublicID(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.PublicID = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) ReporterEmail(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterEmail = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) ReporterEmailFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterEmail = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetReporterEmail() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterEmail = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomReporterEmail(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterEmail = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) ReporterName(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterName = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) ReporterNameFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterName = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetReporterName() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterName = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomReporterName(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterName = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) ReporterPhone(val string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterPhone = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) ReporterPhoneFunc(f func() string) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterPhone = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetReporterPhone() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterPhone = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomReporterPhone(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterPhone = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) Status(val enums.PublicreportReportstatustype) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Status = func() enums.PublicreportReportstatustype { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) StatusFunc(f func() enums.PublicreportReportstatustype) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Status = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetStatus() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Status = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomStatus(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.Status = func() enums.PublicreportReportstatustype {
|
|
return random_enums_PublicreportReportstatustype(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) OrganizationID(val null.Val[int32]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OrganizationID = func() null.Val[int32] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) OrganizationIDFunc(f func() null.Val[int32]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OrganizationID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetOrganizationID() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OrganizationID = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m publicreportPoolMods) RandomOrganizationID(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OrganizationID = func() null.Val[int32] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_int32(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m publicreportPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.OrganizationID = func() null.Val[int32] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_int32(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) HasBackyardPermission(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasBackyardPermission = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) HasBackyardPermissionFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasBackyardPermission = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetHasBackyardPermission() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasBackyardPermission = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomHasBackyardPermission(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.HasBackyardPermission = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) IsReporterConfidential(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterConfidential = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) IsReporterConfidentialFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterConfidential = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetIsReporterConfidential() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterConfidential = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomIsReporterConfidential(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterConfidential = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) IsReporterOwner(val bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterOwner = func() bool { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) IsReporterOwnerFunc(f func() bool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterOwner = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetIsReporterOwner() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterOwner = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m publicreportPoolMods) RandomIsReporterOwner(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.IsReporterOwner = func() bool {
|
|
return random_bool(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m publicreportPoolMods) ReporterContactConsent(val null.Val[bool]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterContactConsent = func() null.Val[bool] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m publicreportPoolMods) ReporterContactConsentFunc(f func() null.Val[bool]) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterContactConsent = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m publicreportPoolMods) UnsetReporterContactConsent() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterContactConsent = 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 publicreportPoolMods) RandomReporterContactConsent(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterContactConsent = func() null.Val[bool] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_bool(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 publicreportPoolMods) RandomReporterContactConsentNotNull(f *faker.Faker) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) {
|
|
o.ReporterContactConsent = func() null.Val[bool] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_bool(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithParentsCascading() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
if isDone, _ := publicreportPoolWithParentsCascadingCtx.Value(ctx); isDone {
|
|
return
|
|
}
|
|
ctx = publicreportPoolWithParentsCascadingCtx.WithValue(ctx, true)
|
|
{
|
|
|
|
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
|
|
m.WithOrganization(related).Apply(ctx, o)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithOrganization(rel *OrganizationTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Organization = &publicreportPoolROrganizationR{
|
|
o: rel,
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNewOrganization(mods ...OrganizationMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewOrganizationWithContext(ctx, mods...)
|
|
|
|
m.WithOrganization(related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithExistingOrganization(em *models.Organization) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Organization = &publicreportPoolROrganizationR{
|
|
o: o.f.FromExistingOrganization(em),
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithoutOrganization() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Organization = nil
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyEmailPools = []*publicreportPoolRNotifyEmailPoolsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNewNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...)
|
|
m.WithNotifyEmailPools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyEmailPools = append(o.r.NotifyEmailPools, &publicreportPoolRNotifyEmailPoolsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddNewNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...)
|
|
m.AddNotifyEmailPools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddExistingNotifyEmailPools(existingModels ...*models.PublicreportNotifyEmailPool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.NotifyEmailPools = append(o.r.NotifyEmailPools, &publicreportPoolRNotifyEmailPoolsR{
|
|
o: o.f.FromExistingPublicreportNotifyEmailPool(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithoutNotifyEmailPools() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyEmailPools = nil
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyPhonePools = []*publicreportPoolRNotifyPhonePoolsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNewNotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...)
|
|
m.WithNotifyPhonePools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddNotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyPhonePools = append(o.r.NotifyPhonePools, &publicreportPoolRNotifyPhonePoolsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddNewNotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...)
|
|
m.AddNotifyPhonePools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddExistingNotifyPhonePools(existingModels ...*models.PublicreportNotifyPhonePool) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.NotifyPhonePools = append(o.r.NotifyPhonePools, &publicreportPoolRNotifyPhonePoolsR{
|
|
o: o.f.FromExistingPublicreportNotifyPhonePool(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithoutNotifyPhonePools() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.NotifyPhonePools = nil
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithImages(number int, related *PublicreportImageTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Images = []*publicreportPoolRImagesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithNewImages(number int, mods ...PublicreportImageMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportImageWithContext(ctx, mods...)
|
|
m.WithImages(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddImages(number int, related *PublicreportImageTemplate) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Images = append(o.r.Images, &publicreportPoolRImagesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddNewImages(number int, mods ...PublicreportImageMod) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
related := o.f.NewPublicreportImageWithContext(ctx, mods...)
|
|
m.AddImages(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) AddExistingImages(existingModels ...*models.PublicreportImage) PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Images = append(o.r.Images, &publicreportPoolRImagesR{
|
|
o: o.f.FromExistingPublicreportImage(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m publicreportPoolMods) WithoutImages() PublicreportPoolMod {
|
|
return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) {
|
|
o.r.Images = nil
|
|
})
|
|
}
|