Go to h3 v4, Add initial h3 aggregation work

This calculates the summary information of data in h3 nodes and puts it
in the database for fast lookup.
This commit is contained in:
Eli Ribble 2025-11-13 23:48:41 +00:00
parent 7919f0da66
commit e48abb09c0
No known key found for this signature in database
120 changed files with 8516 additions and 1539 deletions

View file

@ -120,9 +120,19 @@ var (
fsZones2WithParentsCascadingCtx = newContextual[bool]("fsZones2WithParentsCascading")
fsZones2RelOrganizationCtx = newContextual[bool]("fs_zones2.organization.fs_zones2.fs_zones2_organization_id_fkey")
// Relationship Contexts for geography_columns
geographyColumnWithParentsCascadingCtx = newContextual[bool]("geographyColumnWithParentsCascading")
// Relationship Contexts for geometry_columns
geometryColumnWithParentsCascadingCtx = newContextual[bool]("geometryColumnWithParentsCascading")
// Relationship Contexts for goose_db_version
gooseDBVersionWithParentsCascadingCtx = newContextual[bool]("gooseDBVersionWithParentsCascading")
// Relationship Contexts for h3_aggregation
h3AggregationWithParentsCascadingCtx = newContextual[bool]("h3AggregationWithParentsCascading")
h3AggregationRelOrganizationCtx = newContextual[bool]("h3_aggregation.organization.h3_aggregation.h3_aggregation_organization_id_fkey")
// Relationship Contexts for history_containerrelate
historyContainerrelateWithParentsCascadingCtx = newContextual[bool]("historyContainerrelateWithParentsCascading")
historyContainerrelateRelOrganizationCtx = newContextual[bool]("history_containerrelate.organization.history_containerrelate.history_containerrelate_organization_id_fkey")
@ -269,6 +279,7 @@ var (
organizationRelFSTreatmentareasCtx = newContextual[bool]("fs_treatmentarea.organization.fs_treatmentarea.fs_treatmentarea_organization_id_fkey")
organizationRelFSZonesCtx = newContextual[bool]("fs_zones.organization.fs_zones.fs_zones_organization_id_fkey")
organizationRelFSZones2sCtx = newContextual[bool]("fs_zones2.organization.fs_zones2.fs_zones2_organization_id_fkey")
organizationRelH3AggregationsCtx = newContextual[bool]("h3_aggregation.organization.h3_aggregation.h3_aggregation_organization_id_fkey")
organizationRelHistoryContainerrelatesCtx = newContextual[bool]("history_containerrelate.organization.history_containerrelate.history_containerrelate_organization_id_fkey")
organizationRelHistoryFieldscoutinglogsCtx = newContextual[bool]("history_fieldscoutinglog.organization.history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey")
organizationRelHistoryHabitatrelatesCtx = newContextual[bool]("history_habitatrelate.organization.history_habitatrelate.history_habitatrelate_organization_id_fkey")
@ -298,9 +309,18 @@ var (
organizationRelHistoryZones2sCtx = newContextual[bool]("history_zones2.organization.history_zones2.history_zones2_organization_id_fkey")
organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey")
// Relationship Contexts for raster_columns
rasterColumnWithParentsCascadingCtx = newContextual[bool]("rasterColumnWithParentsCascading")
// Relationship Contexts for raster_overviews
rasterOverviewWithParentsCascadingCtx = newContextual[bool]("rasterOverviewWithParentsCascading")
// Relationship Contexts for sessions
sessionWithParentsCascadingCtx = newContextual[bool]("sessionWithParentsCascading")
// Relationship Contexts for spatial_ref_sys
spatialRefSyWithParentsCascadingCtx = newContextual[bool]("spatialRefSyWithParentsCascading")
// Relationship Contexts for user_
userWithParentsCascadingCtx = newContextual[bool]("userWithParentsCascading")
userRelUserNotificationsCtx = newContextual[bool]("notification.user_.notification.notification_user_id_fkey")

View file

@ -10,6 +10,7 @@ import (
enums "github.com/Gleipnir-Technology/nidus-sync/enums"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
"github.com/lib/pq"
)
type Factory struct {
@ -41,7 +42,10 @@ type Factory struct {
baseFSTreatmentareaMods FSTreatmentareaModSlice
baseFSZoneMods FSZoneModSlice
baseFSZones2Mods FSZones2ModSlice
baseGeographyColumnMods GeographyColumnModSlice
baseGeometryColumnMods GeometryColumnModSlice
baseGooseDBVersionMods GooseDBVersionModSlice
baseH3AggregationMods H3AggregationModSlice
baseHistoryContainerrelateMods HistoryContainerrelateModSlice
baseHistoryFieldscoutinglogMods HistoryFieldscoutinglogModSlice
baseHistoryHabitatrelateMods HistoryHabitatrelateModSlice
@ -72,7 +76,10 @@ type Factory struct {
baseNotificationMods NotificationModSlice
baseOauthTokenMods OauthTokenModSlice
baseOrganizationMods OrganizationModSlice
baseRasterColumnMods RasterColumnModSlice
baseRasterOverviewMods RasterOverviewModSlice
baseSessionMods SessionModSlice
baseSpatialRefSyMods SpatialRefSyModSlice
baseUserMods UserModSlice
}
@ -139,7 +146,7 @@ func (f *Factory) FromExistingFSContainerrelate(m *models.FSContainerrelate) *FS
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Inspsampleid = func() null.Val[string] { return m.Inspsampleid }
o.Mosquitoinspid = func() null.Val[string] { return m.Mosquitoinspid }
o.Objectid = func() int32 { return m.Objectid }
@ -184,7 +191,7 @@ func (f *Factory) FromExistingFSFieldscoutinglog(m *models.FSFieldscoutinglog) *
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Objectid = func() int32 { return m.Objectid }
o.Status = func() null.Val[int16] { return m.Status }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
@ -228,7 +235,7 @@ func (f *Factory) FromExistingFSHabitatrelate(m *models.FSHabitatrelate) *FSHabi
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.ForeignID = func() null.Val[string] { return m.ForeignID }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitattype = func() null.Val[string] { return m.Habitattype }
o.Objectid = func() int32 { return m.Objectid }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
@ -271,7 +278,7 @@ func (f *Factory) FromExistingFSInspectionsample(m *models.FSInspectionsample) *
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Idbytech = func() null.Val[string] { return m.Idbytech }
o.InspID = func() null.Val[string] { return m.InspID }
o.Objectid = func() int32 { return m.Objectid }
@ -325,7 +332,7 @@ func (f *Factory) FromExistingFSInspectionsampledetail(m *models.FSInspectionsam
o.Flarvcount = func() null.Val[int16] { return m.Flarvcount }
o.Flstages = func() null.Val[string] { return m.Flstages }
o.Fpupcount = func() null.Val[int16] { return m.Fpupcount }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.InspsampleID = func() null.Val[string] { return m.InspsampleID }
o.Labspecies = func() null.Val[string] { return m.Labspecies }
o.Ldomstage = func() null.Val[string] { return m.Ldomstage }
@ -380,7 +387,7 @@ func (f *Factory) FromExistingFSLinelocation(m *models.FSLinelocation) *FSLinelo
o.Externalid = func() null.Val[string] { return m.Externalid }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Hectares = func() null.Val[float64] { return m.Hectares }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
@ -456,7 +463,7 @@ func (f *Factory) FromExistingFSLocationtracking(m *models.FSLocationtracking) *
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Objectid = func() int32 { return m.Objectid }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
@ -513,7 +520,7 @@ func (f *Factory) FromExistingFSMosquitoinspection(m *models.FSMosquitoinspectio
o.Editor = func() null.Val[string] { return m.Editor }
o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies }
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent }
o.Linelocid = func() null.Val[string] { return m.Linelocid }
@ -592,7 +599,7 @@ func (f *Factory) FromExistingFSPointlocation(m *models.FSPointlocation) *FSPoin
o.Externalid = func() null.Val[string] { return m.Externalid }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval }
@ -623,8 +630,8 @@ func (f *Factory) FromExistingFSPointlocation(m *models.FSPointlocation) *FSPoin
o.Y = func() null.Val[float64] { return m.Y }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
o.GeometryY = func() null.Val[float64] { return m.GeometryY }
o.GeometryX = func() float64 { return m.GeometryX }
o.GeometryY = func() float64 { return m.GeometryY }
o.Assignedtech = func() null.Val[string] { return m.Assignedtech }
o.DeactivateReason = func() null.Val[string] { return m.DeactivateReason }
o.Scalarpriority = func() null.Val[int64] { return m.Scalarpriority }
@ -670,7 +677,7 @@ func (f *Factory) FromExistingFSPolygonlocation(m *models.FSPolygonlocation) *FS
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Filter = func() null.Val[string] { return m.Filter }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Hectares = func() null.Val[float64] { return m.Hectares }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
@ -743,7 +750,7 @@ func (f *Factory) FromExistingFSPool(m *models.FSPool) *FSPoolTemplate {
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Lab = func() null.Val[string] { return m.Lab }
o.LabID = func() null.Val[string] { return m.LabID }
o.Objectid = func() int32 { return m.Objectid }
@ -798,7 +805,7 @@ func (f *Factory) FromExistingFSPooldetail(m *models.FSPooldetail) *FSPooldetail
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Females = func() null.Val[int16] { return m.Females }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Objectid = func() int32 { return m.Objectid }
o.PoolID = func() null.Val[string] { return m.PoolID }
o.Species = func() null.Val[string] { return m.Species }
@ -850,7 +857,7 @@ func (f *Factory) FromExistingFSProposedtreatmentarea(m *models.FSProposedtreatm
o.Exported = func() null.Val[int16] { return m.Exported }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Hectares = func() null.Val[float64] { return m.Hectares }
o.Issprayroute = func() null.Val[int16] { return m.Issprayroute }
o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity }
@ -918,7 +925,7 @@ func (f *Factory) FromExistingFSQamosquitoinspection(m *models.FSQamosquitoinspe
o.Editor = func() null.Val[string] { return m.Editor }
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Fish = func() null.Val[int16] { return m.Fish }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habvalue1 = func() null.Val[int16] { return m.Habvalue1 }
o.Habvalue1percent = func() null.Val[int16] { return m.Habvalue1percent }
o.Habvalue2 = func() null.Val[int16] { return m.Habvalue2 }
@ -1007,7 +1014,7 @@ func (f *Factory) FromExistingFSRodentlocation(m *models.FSRodentlocation) *FSRo
o.Externalid = func() null.Val[string] { return m.Externalid }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Lastinspectaction = func() null.Val[string] { return m.Lastinspectaction }
o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions }
@ -1076,7 +1083,7 @@ func (f *Factory) FromExistingFSSamplecollection(m *models.FSSamplecollection) *
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Flockid = func() null.Val[string] { return m.Flockid }
o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Lab = func() null.Val[string] { return m.Lab }
o.Locationname = func() null.Val[string] { return m.Locationname }
o.LocID = func() null.Val[string] { return m.LocID }
@ -1148,7 +1155,7 @@ func (f *Factory) FromExistingFSSamplelocation(m *models.FSSamplelocation) *FSSa
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Locationnumber = func() null.Val[int64] { return m.Locationnumber }
o.Name = func() null.Val[string] { return m.Name }
@ -1224,7 +1231,7 @@ func (f *Factory) FromExistingFSServicerequest(m *models.FSServicerequest) *FSSe
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Firstresponsedate = func() null.Val[int64] { return m.Firstresponsedate }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Issuesreported = func() null.Val[string] { return m.Issuesreported }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
o.Nextaction = func() null.Val[string] { return m.Nextaction }
@ -1274,8 +1281,8 @@ func (f *Factory) FromExistingFSServicerequest(m *models.FSServicerequest) *FSSe
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
o.GeometryY = func() null.Val[float64] { return m.GeometryY }
o.GeometryX = func() float64 { return m.GeometryX }
o.GeometryY = func() float64 { return m.GeometryY }
o.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate }
o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser }
o.Dog = func() null.Val[int64] { return m.Dog }
@ -1320,7 +1327,7 @@ func (f *Factory) FromExistingFSSpeciesabundance(m *models.FSSpeciesabundance) *
o.Editor = func() null.Val[string] { return m.Editor }
o.Females = func() null.Val[int64] { return m.Females }
o.Gravidfem = func() null.Val[int16] { return m.Gravidfem }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Larvae = func() null.Val[int16] { return m.Larvae }
o.Males = func() null.Val[int16] { return m.Males }
o.Objectid = func() int32 { return m.Objectid }
@ -1377,7 +1384,7 @@ func (f *Factory) FromExistingFSStormdrain(m *models.FSStormdrain) *FSStormdrain
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction }
o.Lastaction = func() null.Val[string] { return m.Lastaction }
o.Laststatus = func() null.Val[string] { return m.Laststatus }
@ -1434,7 +1441,7 @@ func (f *Factory) FromExistingFSTimecard(m *models.FSTimecard) *FSTimecardTempla
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Lclocid = func() null.Val[string] { return m.Lclocid }
o.Linelocid = func() null.Val[string] { return m.Linelocid }
o.Locationname = func() null.Val[string] { return m.Locationname }
@ -1494,7 +1501,7 @@ func (f *Factory) FromExistingFSTrapdatum(m *models.FSTrapdatum) *FSTrapdatumTem
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Field = func() null.Val[int64] { return m.Field }
o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Idbytech = func() null.Val[string] { return m.Idbytech }
o.Locationname = func() null.Val[string] { return m.Locationname }
o.LocID = func() null.Val[string] { return m.LocID }
@ -1568,7 +1575,7 @@ func (f *Factory) FromExistingFSTraplocation(m *models.FSTraplocation) *FSTraplo
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.Locationnumber = func() null.Val[int64] { return m.Locationnumber }
o.Name = func() null.Val[string] { return m.Name }
@ -1635,7 +1642,7 @@ func (f *Factory) FromExistingFSTreatment(m *models.FSTreatment) *FSTreatmentTem
o.Editor = func() null.Val[string] { return m.Editor }
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Flowrate = func() null.Val[float64] { return m.Flowrate }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Habitat = func() null.Val[string] { return m.Habitat }
o.InspID = func() null.Val[string] { return m.InspID }
o.Invloc = func() null.Val[string] { return m.Invloc }
@ -1711,7 +1718,7 @@ func (f *Factory) FromExistingFSTreatmentarea(m *models.FSTreatmentarea) *FSTrea
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Notified = func() null.Val[int16] { return m.Notified }
o.Objectid = func() int32 { return m.Objectid }
o.SessionID = func() null.Val[string] { return m.SessionID }
@ -1761,7 +1768,7 @@ func (f *Factory) FromExistingFSZone(m *models.FSZone) *FSZoneTemplate {
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Name = func() null.Val[string] { return m.Name }
o.Objectid = func() int32 { return m.Objectid }
o.ShapeArea = func() null.Val[float64] { return m.ShapeArea }
@ -1806,7 +1813,7 @@ func (f *Factory) FromExistingFSZones2(m *models.FSZones2) *FSZones2Template {
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
o.Editor = func() null.Val[string] { return m.Editor }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Globalid = func() string { return m.Globalid }
o.Name = func() null.Val[string] { return m.Name }
o.Objectid = func() int32 { return m.Objectid }
o.ShapeArea = func() null.Val[float64] { return m.ShapeArea }
@ -1827,6 +1834,66 @@ func (f *Factory) FromExistingFSZones2(m *models.FSZones2) *FSZones2Template {
return o
}
func (f *Factory) NewGeographyColumn(mods ...GeographyColumnMod) *GeographyColumnTemplate {
return f.NewGeographyColumnWithContext(context.Background(), mods...)
}
func (f *Factory) NewGeographyColumnWithContext(ctx context.Context, mods ...GeographyColumnMod) *GeographyColumnTemplate {
o := &GeographyColumnTemplate{f: f}
if f != nil {
f.baseGeographyColumnMods.Apply(ctx, o)
}
GeographyColumnModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingGeographyColumn(m *models.GeographyColumn) *GeographyColumnTemplate {
o := &GeographyColumnTemplate{f: f, alreadyPersisted: true}
o.FTableCatalog = func() null.Val[string] { return m.FTableCatalog }
o.FTableSchema = func() null.Val[string] { return m.FTableSchema }
o.FTableName = func() null.Val[string] { return m.FTableName }
o.FGeographyColumn = func() null.Val[string] { return m.FGeographyColumn }
o.CoordDimension = func() null.Val[int32] { return m.CoordDimension }
o.Srid = func() null.Val[int32] { return m.Srid }
o.Type = func() null.Val[string] { return m.Type }
return o
}
func (f *Factory) NewGeometryColumn(mods ...GeometryColumnMod) *GeometryColumnTemplate {
return f.NewGeometryColumnWithContext(context.Background(), mods...)
}
func (f *Factory) NewGeometryColumnWithContext(ctx context.Context, mods ...GeometryColumnMod) *GeometryColumnTemplate {
o := &GeometryColumnTemplate{f: f}
if f != nil {
f.baseGeometryColumnMods.Apply(ctx, o)
}
GeometryColumnModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingGeometryColumn(m *models.GeometryColumn) *GeometryColumnTemplate {
o := &GeometryColumnTemplate{f: f, alreadyPersisted: true}
o.FTableCatalog = func() null.Val[string] { return m.FTableCatalog }
o.FTableSchema = func() null.Val[string] { return m.FTableSchema }
o.FTableName = func() null.Val[string] { return m.FTableName }
o.FGeometryColumn = func() null.Val[string] { return m.FGeometryColumn }
o.CoordDimension = func() null.Val[int32] { return m.CoordDimension }
o.Srid = func() null.Val[int32] { return m.Srid }
o.Type = func() null.Val[string] { return m.Type }
return o
}
func (f *Factory) NewGooseDBVersion(mods ...GooseDBVersionMod) *GooseDBVersionTemplate {
return f.NewGooseDBVersionWithContext(context.Background(), mods...)
}
@ -1854,6 +1921,40 @@ func (f *Factory) FromExistingGooseDBVersion(m *models.GooseDBVersion) *GooseDBV
return o
}
func (f *Factory) NewH3Aggregation(mods ...H3AggregationMod) *H3AggregationTemplate {
return f.NewH3AggregationWithContext(context.Background(), mods...)
}
func (f *Factory) NewH3AggregationWithContext(ctx context.Context, mods ...H3AggregationMod) *H3AggregationTemplate {
o := &H3AggregationTemplate{f: f}
if f != nil {
f.baseH3AggregationMods.Apply(ctx, o)
}
H3AggregationModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingH3Aggregation(m *models.H3Aggregation) *H3AggregationTemplate {
o := &H3AggregationTemplate{f: f, alreadyPersisted: true}
o.ID = func() int32 { return m.ID }
o.Cell = func() string { return m.Cell }
o.Resolution = func() int32 { return m.Resolution }
o.Count = func() int32 { return m.Count }
o.Type = func() enums.H3aggregationtype { return m.Type }
o.OrganizationID = func() int32 { return m.OrganizationID }
ctx := context.Background()
if m.R.Organization != nil {
H3AggregationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o)
}
return o
}
func (f *Factory) NewHistoryContainerrelate(mods ...HistoryContainerrelateMod) *HistoryContainerrelateTemplate {
return f.NewHistoryContainerrelateWithContext(context.Background(), mods...)
}
@ -3777,6 +3878,9 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization
if len(m.R.FSZones2s) > 0 {
OrganizationMods.AddExistingFSZones2s(m.R.FSZones2s...).Apply(ctx, o)
}
if len(m.R.H3Aggregations) > 0 {
OrganizationMods.AddExistingH3Aggregations(m.R.H3Aggregations...).Apply(ctx, o)
}
if len(m.R.HistoryContainerrelates) > 0 {
OrganizationMods.AddExistingHistoryContainerrelates(m.R.HistoryContainerrelates...).Apply(ctx, o)
}
@ -3865,6 +3969,78 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization
return o
}
func (f *Factory) NewRasterColumn(mods ...RasterColumnMod) *RasterColumnTemplate {
return f.NewRasterColumnWithContext(context.Background(), mods...)
}
func (f *Factory) NewRasterColumnWithContext(ctx context.Context, mods ...RasterColumnMod) *RasterColumnTemplate {
o := &RasterColumnTemplate{f: f}
if f != nil {
f.baseRasterColumnMods.Apply(ctx, o)
}
RasterColumnModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingRasterColumn(m *models.RasterColumn) *RasterColumnTemplate {
o := &RasterColumnTemplate{f: f, alreadyPersisted: true}
o.RTableCatalog = func() null.Val[string] { return m.RTableCatalog }
o.RTableSchema = func() null.Val[string] { return m.RTableSchema }
o.RTableName = func() null.Val[string] { return m.RTableName }
o.RRasterColumn = func() null.Val[string] { return m.RRasterColumn }
o.Srid = func() null.Val[int32] { return m.Srid }
o.ScaleX = func() null.Val[float64] { return m.ScaleX }
o.ScaleY = func() null.Val[float64] { return m.ScaleY }
o.BlocksizeX = func() null.Val[int32] { return m.BlocksizeX }
o.BlocksizeY = func() null.Val[int32] { return m.BlocksizeY }
o.SameAlignment = func() null.Val[bool] { return m.SameAlignment }
o.RegularBlocking = func() null.Val[bool] { return m.RegularBlocking }
o.NumBands = func() null.Val[int32] { return m.NumBands }
o.PixelTypes = func() null.Val[pq.StringArray] { return m.PixelTypes }
o.NodataValues = func() null.Val[pq.Float64Array] { return m.NodataValues }
o.OutDB = func() null.Val[pq.BoolArray] { return m.OutDB }
o.Extent = func() null.Val[string] { return m.Extent }
o.SpatialIndex = func() null.Val[bool] { return m.SpatialIndex }
return o
}
func (f *Factory) NewRasterOverview(mods ...RasterOverviewMod) *RasterOverviewTemplate {
return f.NewRasterOverviewWithContext(context.Background(), mods...)
}
func (f *Factory) NewRasterOverviewWithContext(ctx context.Context, mods ...RasterOverviewMod) *RasterOverviewTemplate {
o := &RasterOverviewTemplate{f: f}
if f != nil {
f.baseRasterOverviewMods.Apply(ctx, o)
}
RasterOverviewModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingRasterOverview(m *models.RasterOverview) *RasterOverviewTemplate {
o := &RasterOverviewTemplate{f: f, alreadyPersisted: true}
o.OTableCatalog = func() null.Val[string] { return m.OTableCatalog }
o.OTableSchema = func() null.Val[string] { return m.OTableSchema }
o.OTableName = func() null.Val[string] { return m.OTableName }
o.ORasterColumn = func() null.Val[string] { return m.ORasterColumn }
o.RTableCatalog = func() null.Val[string] { return m.RTableCatalog }
o.RTableSchema = func() null.Val[string] { return m.RTableSchema }
o.RTableName = func() null.Val[string] { return m.RTableName }
o.RRasterColumn = func() null.Val[string] { return m.RRasterColumn }
o.OverviewFactor = func() null.Val[int32] { return m.OverviewFactor }
return o
}
func (f *Factory) NewSession(mods ...SessionMod) *SessionTemplate {
return f.NewSessionWithContext(context.Background(), mods...)
}
@ -3891,6 +4067,34 @@ func (f *Factory) FromExistingSession(m *models.Session) *SessionTemplate {
return o
}
func (f *Factory) NewSpatialRefSy(mods ...SpatialRefSyMod) *SpatialRefSyTemplate {
return f.NewSpatialRefSyWithContext(context.Background(), mods...)
}
func (f *Factory) NewSpatialRefSyWithContext(ctx context.Context, mods ...SpatialRefSyMod) *SpatialRefSyTemplate {
o := &SpatialRefSyTemplate{f: f}
if f != nil {
f.baseSpatialRefSyMods.Apply(ctx, o)
}
SpatialRefSyModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingSpatialRefSy(m *models.SpatialRefSy) *SpatialRefSyTemplate {
o := &SpatialRefSyTemplate{f: f, alreadyPersisted: true}
o.Srid = func() int32 { return m.Srid }
o.AuthName = func() null.Val[string] { return m.AuthName }
o.AuthSrid = func() null.Val[int32] { return m.AuthSrid }
o.Srtext = func() null.Val[string] { return m.Srtext }
o.Proj4text = func() null.Val[string] { return m.Proj4text }
return o
}
func (f *Factory) NewUser(mods ...UserMod) *UserTemplate {
return f.NewUserWithContext(context.Background(), mods...)
}
@ -4161,6 +4365,22 @@ func (f *Factory) AddBaseFSZones2Mod(mods ...FSZones2Mod) {
f.baseFSZones2Mods = append(f.baseFSZones2Mods, mods...)
}
func (f *Factory) ClearBaseGeographyColumnMods() {
f.baseGeographyColumnMods = nil
}
func (f *Factory) AddBaseGeographyColumnMod(mods ...GeographyColumnMod) {
f.baseGeographyColumnMods = append(f.baseGeographyColumnMods, mods...)
}
func (f *Factory) ClearBaseGeometryColumnMods() {
f.baseGeometryColumnMods = nil
}
func (f *Factory) AddBaseGeometryColumnMod(mods ...GeometryColumnMod) {
f.baseGeometryColumnMods = append(f.baseGeometryColumnMods, mods...)
}
func (f *Factory) ClearBaseGooseDBVersionMods() {
f.baseGooseDBVersionMods = nil
}
@ -4169,6 +4389,14 @@ func (f *Factory) AddBaseGooseDBVersionMod(mods ...GooseDBVersionMod) {
f.baseGooseDBVersionMods = append(f.baseGooseDBVersionMods, mods...)
}
func (f *Factory) ClearBaseH3AggregationMods() {
f.baseH3AggregationMods = nil
}
func (f *Factory) AddBaseH3AggregationMod(mods ...H3AggregationMod) {
f.baseH3AggregationMods = append(f.baseH3AggregationMods, mods...)
}
func (f *Factory) ClearBaseHistoryContainerrelateMods() {
f.baseHistoryContainerrelateMods = nil
}
@ -4409,6 +4637,22 @@ func (f *Factory) AddBaseOrganizationMod(mods ...OrganizationMod) {
f.baseOrganizationMods = append(f.baseOrganizationMods, mods...)
}
func (f *Factory) ClearBaseRasterColumnMods() {
f.baseRasterColumnMods = nil
}
func (f *Factory) AddBaseRasterColumnMod(mods ...RasterColumnMod) {
f.baseRasterColumnMods = append(f.baseRasterColumnMods, mods...)
}
func (f *Factory) ClearBaseRasterOverviewMods() {
f.baseRasterOverviewMods = nil
}
func (f *Factory) AddBaseRasterOverviewMod(mods ...RasterOverviewMod) {
f.baseRasterOverviewMods = append(f.baseRasterOverviewMods, mods...)
}
func (f *Factory) ClearBaseSessionMods() {
f.baseSessionMods = nil
}
@ -4417,6 +4661,14 @@ func (f *Factory) AddBaseSessionMod(mods ...SessionMod) {
f.baseSessionMods = append(f.baseSessionMods, mods...)
}
func (f *Factory) ClearBaseSpatialRefSyMods() {
f.baseSpatialRefSyMods = nil
}
func (f *Factory) AddBaseSpatialRefSyMod(mods ...SpatialRefSyMod) {
f.baseSpatialRefSyMods = append(f.baseSpatialRefSyMods, mods...)
}
func (f *Factory) ClearBaseUserMods() {
f.baseUserMods = nil
}

View file

@ -704,6 +704,30 @@ func TestCreateGooseDBVersion(t *testing.T) {
}
}
func TestCreateH3Aggregation(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")
}
ctx, cancel := context.WithCancel(t.Context())
t.Cleanup(cancel)
tx, err := testDB.Begin(ctx)
if err != nil {
t.Fatalf("Error starting transaction: %v", err)
}
defer func() {
if err := tx.Rollback(ctx); err != nil {
t.Fatalf("Error rolling back transaction: %v", err)
}
}()
if _, err := New().NewH3AggregationWithContext(ctx).Create(ctx, tx); err != nil {
t.Fatalf("Error creating H3Aggregation: %v", err)
}
}
func TestCreateHistoryContainerrelate(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")
@ -1448,6 +1472,30 @@ func TestCreateSession(t *testing.T) {
}
}
func TestCreateSpatialRefSy(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")
}
ctx, cancel := context.WithCancel(t.Context())
t.Cleanup(cancel)
tx, err := testDB.Begin(ctx)
if err != nil {
t.Fatalf("Error starting transaction: %v", err)
}
defer func() {
if err := tx.Rollback(ctx); err != nil {
t.Fatalf("Error rolling back transaction: %v", err)
}
}()
if _, err := New().NewSpatialRefSyWithContext(ctx).Create(ctx, tx); err != nil {
t.Fatalf("Error creating SpatialRefSy: %v", err)
}
}
func TestCreateUser(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")

View file

@ -11,6 +11,7 @@ import (
enums "github.com/Gleipnir-Technology/nidus-sync/enums"
"github.com/jaswdr/faker/v2"
"github.com/lib/pq"
)
var defaultFaker = faker.New()
@ -41,6 +42,16 @@ func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcg
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_H3aggregationtype(f *faker.Faker, limits ...string) enums.H3aggregationtype {
if f == nil {
f = &defaultFaker
}
var e enums.H3aggregationtype
all := e.All()
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_Hashtype(f *faker.Faker, limits ...string) enums.Hashtype {
if f == nil {
f = &defaultFaker
@ -114,6 +125,42 @@ func random_int64(f *faker.Faker, limits ...string) int64 {
return f.Int64()
}
func random_pq_BoolArray(f *faker.Faker, limits ...string) pq.BoolArray {
if f == nil {
f = &defaultFaker
}
arr := make(pq.BoolArray, f.IntBetween(1, 5))
for i := range arr {
arr[i] = random_bool(f, limits...)
}
return arr
}
func random_pq_Float64Array(f *faker.Faker, limits ...string) pq.Float64Array {
if f == nil {
f = &defaultFaker
}
arr := make(pq.Float64Array, f.IntBetween(1, 5))
for i := range arr {
arr[i] = random_float64(f, limits...)
}
return arr
}
func random_pq_StringArray(f *faker.Faker, limits ...string) pq.StringArray {
if f == nil {
f = &defaultFaker
}
arr := make(pq.StringArray, f.IntBetween(1, 5))
for i := range arr {
arr[i] = random_string(f, limits...)
}
return arr
}
func random_string(f *faker.Faker, limits ...string) string {
if f == nil {
f = &defaultFaker

View file

@ -5,6 +5,7 @@ package factory
import (
"bytes"
"slices"
"testing"
"github.com/stephenafamo/bob"
@ -68,6 +69,28 @@ func TestRandom_int64(t *testing.T) {
}
}
func TestRandom_pq_Float64Array(t *testing.T) {
t.Parallel()
val1 := random_pq_Float64Array(nil)
val2 := random_pq_Float64Array(nil)
if slices.Equal(val1, val2) {
t.Fatalf("random_pq_Float64Array() returned the same value twice: %v", val1)
}
}
func TestRandom_pq_StringArray(t *testing.T) {
t.Parallel()
val1 := random_pq_StringArray(nil)
val2 := random_pq_StringArray(nil)
if slices.Equal(val1, val2) {
t.Fatalf("random_pq_StringArray() returned the same value twice: %v", val1)
}
}
func TestRandom_string(t *testing.T) {
t.Parallel()

View file

@ -43,7 +43,7 @@ type FSContainerrelateTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Inspsampleid func() null.Val[string]
Mosquitoinspid func() null.Val[string]
Objectid func() int32
@ -119,7 +119,7 @@ func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Inspsampleid != nil {
val := o.Inspsampleid()
@ -265,6 +265,10 @@ func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) {
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)
@ -706,14 +710,14 @@ func (m fsContainerrelateMods) RandomEditorNotNull(f *faker.Faker) FSContainerre
}
// Set the model columns to this value
func (m fsContainerrelateMods) Globalid(val null.Val[string]) FSContainerrelateMod {
func (m fsContainerrelateMods) Globalid(val string) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsContainerrelateMods) GlobalidFunc(f func() null.Val[string]) FSContainerrelateMod {
func (m fsContainerrelateMods) GlobalidFunc(f func() string) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.Globalid = f
})
@ -728,32 +732,10 @@ func (m fsContainerrelateMods) UnsetGlobalid() FSContainerrelateMod {
// 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 fsContainerrelateMods) RandomGlobalid(f *faker.Faker) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsContainerrelateMods) RandomGlobalidNotNull(f *faker.Faker) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -42,7 +42,7 @@ type FSFieldscoutinglogTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Objectid func() int32
Status func() null.Val[int16]
CreatedDate func() null.Val[int64]
@ -112,7 +112,7 @@ func (o FSFieldscoutinglogTemplate) BuildSetter() *models.FSFieldscoutinglogSett
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Objectid != nil {
val := o.Objectid()
@ -241,6 +241,10 @@ func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) {
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)
@ -626,14 +630,14 @@ func (m fsFieldscoutinglogMods) RandomEditorNotNull(f *faker.Faker) FSFieldscout
}
// Set the model columns to this value
func (m fsFieldscoutinglogMods) Globalid(val null.Val[string]) FSFieldscoutinglogMod {
func (m fsFieldscoutinglogMods) Globalid(val string) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsFieldscoutinglogMods) GlobalidFunc(f func() null.Val[string]) FSFieldscoutinglogMod {
func (m fsFieldscoutinglogMods) GlobalidFunc(f func() string) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.Globalid = f
})
@ -648,32 +652,10 @@ func (m fsFieldscoutinglogMods) UnsetGlobalid() FSFieldscoutinglogMod {
// 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 fsFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsFieldscoutinglogMods) RandomGlobalidNotNull(f *faker.Faker) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -43,7 +43,7 @@ type FSHabitatrelateTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
ForeignID func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Habitattype func() null.Val[string]
Objectid func() int32
CreatedDate func() null.Val[int64]
@ -117,7 +117,7 @@ func (o FSHabitatrelateTemplate) BuildSetter() *models.FSHabitatrelateSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitattype != nil {
val := o.Habitattype()
@ -249,6 +249,10 @@ func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) {
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)
@ -688,14 +692,14 @@ func (m fsHabitatrelateMods) RandomForeignIDNotNull(f *faker.Faker) FSHabitatrel
}
// Set the model columns to this value
func (m fsHabitatrelateMods) Globalid(val null.Val[string]) FSHabitatrelateMod {
func (m fsHabitatrelateMods) Globalid(val string) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsHabitatrelateMods) GlobalidFunc(f func() null.Val[string]) FSHabitatrelateMod {
func (m fsHabitatrelateMods) GlobalidFunc(f func() string) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.Globalid = f
})
@ -710,32 +714,10 @@ func (m fsHabitatrelateMods) UnsetGlobalid() FSHabitatrelateMod {
// 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 fsHabitatrelateMods) RandomGlobalid(f *faker.Faker) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsHabitatrelateMods) RandomGlobalidNotNull(f *faker.Faker) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -42,7 +42,7 @@ type FSInspectionsampleTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Idbytech func() null.Val[string]
InspID func() null.Val[string]
Objectid func() int32
@ -115,7 +115,7 @@ func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSett
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Idbytech != nil {
val := o.Idbytech()
@ -265,6 +265,10 @@ func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) {
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)
@ -653,14 +657,14 @@ func (m fsInspectionsampleMods) RandomEditorNotNull(f *faker.Faker) FSInspection
}
// Set the model columns to this value
func (m fsInspectionsampleMods) Globalid(val null.Val[string]) FSInspectionsampleMod {
func (m fsInspectionsampleMods) Globalid(val string) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) GlobalidFunc(f func() null.Val[string]) FSInspectionsampleMod {
func (m fsInspectionsampleMods) GlobalidFunc(f func() string) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = f
})
@ -675,32 +679,10 @@ func (m fsInspectionsampleMods) UnsetGlobalid() FSInspectionsampleMod {
// 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 fsInspectionsampleMods) RandomGlobalid(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsInspectionsampleMods) RandomGlobalidNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -50,7 +50,7 @@ type FSInspectionsampledetailTemplate struct {
Flarvcount func() null.Val[int16]
Flstages func() null.Val[string]
Fpupcount func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
InspsampleID func() null.Val[string]
Labspecies func() null.Val[string]
Ldomstage func() null.Val[string]
@ -158,7 +158,7 @@ func (o FSInspectionsampledetailTemplate) BuildSetter() *models.FSInspectionsamp
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.InspsampleID != nil {
val := o.InspsampleID()
@ -353,6 +353,10 @@ func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailS
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)
@ -1176,14 +1180,14 @@ func (m fsInspectionsampledetailMods) RandomFpupcountNotNull(f *faker.Faker) FSI
}
// Set the model columns to this value
func (m fsInspectionsampledetailMods) Globalid(val null.Val[string]) FSInspectionsampledetailMod {
func (m fsInspectionsampledetailMods) Globalid(val string) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampledetailMods) GlobalidFunc(f func() null.Val[string]) FSInspectionsampledetailMod {
func (m fsInspectionsampledetailMods) GlobalidFunc(f func() string) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.Globalid = f
})
@ -1198,32 +1202,10 @@ func (m fsInspectionsampledetailMods) UnsetGlobalid() FSInspectionsampledetailMo
// 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 fsInspectionsampledetailMods) RandomGlobalid(f *faker.Faker) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsInspectionsampledetailMods) RandomGlobalidNotNull(f *faker.Faker) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSLinelocationTemplate struct {
Externalid func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Hectares func() null.Val[float64]
Jurisdiction func() null.Val[string]
@ -173,7 +173,7 @@ func (o FSLinelocationTemplate) BuildSetter() *models.FSLinelocationSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -537,6 +537,10 @@ func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) {
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)
@ -1277,14 +1281,14 @@ func (m fsLinelocationMods) RandomEditorNotNull(f *faker.Faker) FSLinelocationMo
}
// Set the model columns to this value
func (m fsLinelocationMods) Globalid(val null.Val[string]) FSLinelocationMod {
func (m fsLinelocationMods) Globalid(val string) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsLinelocationMods) GlobalidFunc(f func() null.Val[string]) FSLinelocationMod {
func (m fsLinelocationMods) GlobalidFunc(f func() string) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.Globalid = f
})
@ -1299,32 +1303,10 @@ func (m fsLinelocationMods) UnsetGlobalid() FSLinelocationMod {
// 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 fsLinelocationMods) RandomGlobalid(f *faker.Faker) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsLinelocationMods) RandomGlobalidNotNull(f *faker.Faker) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -44,7 +44,7 @@ type FSLocationtrackingTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Fieldtech func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Objectid func() int32
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
@ -121,7 +121,7 @@ func (o FSLocationtrackingTemplate) BuildSetter() *models.FSLocationtrackingSett
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Objectid != nil {
val := o.Objectid()
@ -249,6 +249,10 @@ func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) {
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)
@ -741,14 +745,14 @@ func (m fsLocationtrackingMods) RandomFieldtechNotNull(f *faker.Faker) FSLocatio
}
// Set the model columns to this value
func (m fsLocationtrackingMods) Globalid(val null.Val[string]) FSLocationtrackingMod {
func (m fsLocationtrackingMods) Globalid(val string) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsLocationtrackingMods) GlobalidFunc(f func() null.Val[string]) FSLocationtrackingMod {
func (m fsLocationtrackingMods) GlobalidFunc(f func() string) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.Globalid = f
})
@ -763,32 +767,10 @@ func (m fsLocationtrackingMods) UnsetGlobalid() FSLocationtrackingMod {
// 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) RandomGlobalid(f *faker.Faker) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsLocationtrackingMods) RandomGlobalidNotNull(f *faker.Faker) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -57,7 +57,7 @@ type FSMosquitoinspectionTemplate struct {
Editor func() null.Val[string]
Fieldspecies func() null.Val[string]
Fieldtech func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Jurisdiction func() null.Val[string]
Larvaepresent func() null.Val[int16]
Linelocid func() null.Val[string]
@ -218,7 +218,7 @@ func (o FSMosquitoinspectionTemplate) BuildSetter() *models.FSMosquitoinspection
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Jurisdiction != nil {
val := o.Jurisdiction()
@ -609,6 +609,10 @@ func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) {
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)
@ -1835,14 +1839,14 @@ func (m fsMosquitoinspectionMods) RandomFieldtechNotNull(f *faker.Faker) FSMosqu
}
// Set the model columns to this value
func (m fsMosquitoinspectionMods) Globalid(val null.Val[string]) FSMosquitoinspectionMod {
func (m fsMosquitoinspectionMods) Globalid(val string) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsMosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) FSMosquitoinspectionMod {
func (m fsMosquitoinspectionMods) GlobalidFunc(f func() string) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.Globalid = f
})
@ -1857,32 +1861,10 @@ func (m fsMosquitoinspectionMods) UnsetGlobalid() FSMosquitoinspectionMod {
// 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 fsMosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsMosquitoinspectionMods) RandomGlobalidNotNull(f *faker.Faker) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -47,7 +47,7 @@ type FSPointlocationTemplate struct {
Externalid func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Jurisdiction func() null.Val[string]
Larvinspectinterval func() null.Val[int16]
@ -78,8 +78,8 @@ type FSPointlocationTemplate struct {
Y func() null.Val[float64]
Zone func() null.Val[string]
Zone2 func() null.Val[string]
GeometryX func() null.Val[float64]
GeometryY func() null.Val[float64]
GeometryX func() float64
GeometryY func() float64
Assignedtech func() null.Val[string]
DeactivateReason func() null.Val[string]
Scalarpriority func() null.Val[int64]
@ -165,7 +165,7 @@ func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -289,11 +289,11 @@ func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter {
}
if o.GeometryX != nil {
val := o.GeometryX()
m.GeometryX = omitnull.FromNull(val)
m.GeometryX = omit.From(val)
}
if o.GeometryY != nil {
val := o.GeometryY()
m.GeometryY = omitnull.FromNull(val)
m.GeometryY = omit.From(val)
}
if o.Assignedtech != nil {
val := o.Assignedtech()
@ -505,10 +505,22 @@ func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) {
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)
}
if !(m.GeometryX.IsValue()) {
val := random_float64(nil)
m.GeometryX = omit.From(val)
}
if !(m.GeometryY.IsValue()) {
val := random_float64(nil)
m.GeometryY = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.FSPointlocation
@ -1188,14 +1200,14 @@ func (m fsPointlocationMods) RandomEditorNotNull(f *faker.Faker) FSPointlocation
}
// Set the model columns to this value
func (m fsPointlocationMods) Globalid(val null.Val[string]) FSPointlocationMod {
func (m fsPointlocationMods) Globalid(val string) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsPointlocationMods) GlobalidFunc(f func() null.Val[string]) FSPointlocationMod {
func (m fsPointlocationMods) GlobalidFunc(f func() string) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.Globalid = f
})
@ -1210,32 +1222,10 @@ func (m fsPointlocationMods) UnsetGlobalid() FSPointlocationMod {
// 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 fsPointlocationMods) RandomGlobalid(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPointlocationMods) RandomGlobalidNotNull(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}
@ -2809,14 +2799,14 @@ func (m fsPointlocationMods) RandomZone2NotNull(f *faker.Faker) FSPointlocationM
}
// Set the model columns to this value
func (m fsPointlocationMods) GeometryX(val null.Val[float64]) FSPointlocationMod {
func (m fsPointlocationMods) GeometryX(val float64) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
o.GeometryX = func() float64 { return val }
})
}
// Set the Column from the function
func (m fsPointlocationMods) GeometryXFunc(f func() null.Val[float64]) FSPointlocationMod {
func (m fsPointlocationMods) GeometryXFunc(f func() float64) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryX = f
})
@ -2831,45 +2821,23 @@ func (m fsPointlocationMods) UnsetGeometryX() FSPointlocationMod {
// 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 fsPointlocationMods) RandomGeometryX(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
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 fsPointlocationMods) RandomGeometryXNotNull(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryX = func() null.Val[float64] {
if f == nil {
f = &defaultFaker
}
val := random_float64(f)
return null.From(val)
o.GeometryX = func() float64 {
return random_float64(f)
}
})
}
// Set the model columns to this value
func (m fsPointlocationMods) GeometryY(val null.Val[float64]) FSPointlocationMod {
func (m fsPointlocationMods) GeometryY(val float64) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
o.GeometryY = func() float64 { return val }
})
}
// Set the Column from the function
func (m fsPointlocationMods) GeometryYFunc(f func() null.Val[float64]) FSPointlocationMod {
func (m fsPointlocationMods) GeometryYFunc(f func() float64) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryY = f
})
@ -2884,32 +2852,10 @@ func (m fsPointlocationMods) UnsetGeometryY() FSPointlocationMod {
// 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 fsPointlocationMods) RandomGeometryY(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
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 fsPointlocationMods) RandomGeometryYNotNull(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.GeometryY = func() null.Val[float64] {
if f == nil {
f = &defaultFaker
}
val := random_float64(f)
return null.From(val)
o.GeometryY = func() float64 {
return random_float64(f)
}
})
}

View file

@ -49,7 +49,7 @@ type FSPolygonlocationTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Filter func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Hectares func() null.Val[float64]
Jurisdiction func() null.Val[string]
@ -171,7 +171,7 @@ func (o FSPolygonlocationTemplate) BuildSetter() *models.FSPolygonlocationSetter
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -489,6 +489,10 @@ func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) {
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)
@ -1276,14 +1280,14 @@ func (m fsPolygonlocationMods) RandomFilterNotNull(f *faker.Faker) FSPolygonloca
}
// Set the model columns to this value
func (m fsPolygonlocationMods) Globalid(val null.Val[string]) FSPolygonlocationMod {
func (m fsPolygonlocationMods) Globalid(val string) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsPolygonlocationMods) GlobalidFunc(f func() null.Val[string]) FSPolygonlocationMod {
func (m fsPolygonlocationMods) GlobalidFunc(f func() string) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.Globalid = f
})
@ -1298,32 +1302,10 @@ func (m fsPolygonlocationMods) UnsetGlobalid() FSPolygonlocationMod {
// 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 fsPolygonlocationMods) RandomGlobalid(f *faker.Faker) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPolygonlocationMods) RandomGlobalidNotNull(f *faker.Faker) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSPoolTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Gatewaysync func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Lab func() null.Val[string]
LabID func() null.Val[string]
Objectid func() int32
@ -153,7 +153,7 @@ func (o FSPoolTemplate) BuildSetter() *models.FSPoolSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Lab != nil {
val := o.Lab()
@ -377,6 +377,10 @@ func ensureCreatableFSPool(m *models.FSPoolSetter) {
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)
@ -1097,14 +1101,14 @@ func (m fsPoolMods) RandomGatewaysyncNotNull(f *faker.Faker) FSPoolMod {
}
// Set the model columns to this value
func (m fsPoolMods) Globalid(val null.Val[string]) FSPoolMod {
func (m fsPoolMods) Globalid(val string) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsPoolMods) GlobalidFunc(f func() null.Val[string]) FSPoolMod {
func (m fsPoolMods) GlobalidFunc(f func() string) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.Globalid = f
})
@ -1119,32 +1123,10 @@ func (m fsPoolMods) UnsetGlobalid() FSPoolMod {
// 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 fsPoolMods) RandomGlobalid(f *faker.Faker) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPoolMods) RandomGlobalidNotNull(f *faker.Faker) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -43,7 +43,7 @@ type FSPooldetailTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Females func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Objectid func() int32
PoolID func() null.Val[string]
Species func() null.Val[string]
@ -119,7 +119,7 @@ func (o FSPooldetailTemplate) BuildSetter() *models.FSPooldetailSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Objectid != nil {
val := o.Objectid()
@ -265,6 +265,10 @@ func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) {
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)
@ -706,14 +710,14 @@ func (m fsPooldetailMods) RandomFemalesNotNull(f *faker.Faker) FSPooldetailMod {
}
// Set the model columns to this value
func (m fsPooldetailMods) Globalid(val null.Val[string]) FSPooldetailMod {
func (m fsPooldetailMods) Globalid(val string) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsPooldetailMods) GlobalidFunc(f func() null.Val[string]) FSPooldetailMod {
func (m fsPooldetailMods) GlobalidFunc(f func() string) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.Globalid = f
})
@ -728,32 +732,10 @@ func (m fsPooldetailMods) UnsetGlobalid() FSPooldetailMod {
// 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 fsPooldetailMods) RandomGlobalid(f *faker.Faker) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPooldetailMods) RandomGlobalidNotNull(f *faker.Faker) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -49,7 +49,7 @@ type FSProposedtreatmentareaTemplate struct {
Exported func() null.Val[int16]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Hectares func() null.Val[float64]
Issprayroute func() null.Val[int16]
Lasttreatactivity func() null.Val[string]
@ -162,7 +162,7 @@ func (o FSProposedtreatmentareaTemplate) BuildSetter() *models.FSProposedtreatme
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Hectares != nil {
val := o.Hectares()
@ -417,6 +417,10 @@ func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSet
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)
@ -1195,14 +1199,14 @@ func (m fsProposedtreatmentareaMods) RandomEditorNotNull(f *faker.Faker) FSPropo
}
// Set the model columns to this value
func (m fsProposedtreatmentareaMods) Globalid(val null.Val[string]) FSProposedtreatmentareaMod {
func (m fsProposedtreatmentareaMods) Globalid(val string) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsProposedtreatmentareaMods) GlobalidFunc(f func() null.Val[string]) FSProposedtreatmentareaMod {
func (m fsProposedtreatmentareaMods) GlobalidFunc(f func() string) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.Globalid = f
})
@ -1217,32 +1221,10 @@ func (m fsProposedtreatmentareaMods) UnsetGlobalid() FSProposedtreatmentareaMod
// 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 fsProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsProposedtreatmentareaMods) RandomGlobalidNotNull(f *faker.Faker) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -52,7 +52,7 @@ type FSQamosquitoinspectionTemplate struct {
Editor func() null.Val[string]
Fieldtech func() null.Val[string]
Fish func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Habvalue1 func() null.Val[int16]
Habvalue1percent func() null.Val[int16]
Habvalue2 func() null.Val[int16]
@ -203,7 +203,7 @@ func (o FSQamosquitoinspectionTemplate) BuildSetter() *models.FSQamosquitoinspec
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habvalue1 != nil {
val := o.Habvalue1()
@ -649,6 +649,10 @@ func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSette
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)
@ -1615,14 +1619,14 @@ func (m fsQamosquitoinspectionMods) RandomFishNotNull(f *faker.Faker) FSQamosqui
}
// Set the model columns to this value
func (m fsQamosquitoinspectionMods) Globalid(val null.Val[string]) FSQamosquitoinspectionMod {
func (m fsQamosquitoinspectionMods) Globalid(val string) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsQamosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod {
func (m fsQamosquitoinspectionMods) GlobalidFunc(f func() string) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.Globalid = f
})
@ -1637,32 +1641,10 @@ func (m fsQamosquitoinspectionMods) UnsetGlobalid() FSQamosquitoinspectionMod {
// 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 fsQamosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsQamosquitoinspectionMods) RandomGlobalidNotNull(f *faker.Faker) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -47,7 +47,7 @@ type FSRodentlocationTemplate struct {
Externalid func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Lastinspectaction func() null.Val[string]
Lastinspectconditions func() null.Val[string]
@ -151,7 +151,7 @@ func (o FSRodentlocationTemplate) BuildSetter() *models.FSRodentlocationSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -393,6 +393,10 @@ func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) {
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)
@ -1062,14 +1066,14 @@ func (m fsRodentlocationMods) RandomEditorNotNull(f *faker.Faker) FSRodentlocati
}
// Set the model columns to this value
func (m fsRodentlocationMods) Globalid(val null.Val[string]) FSRodentlocationMod {
func (m fsRodentlocationMods) Globalid(val string) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsRodentlocationMods) GlobalidFunc(f func() null.Val[string]) FSRodentlocationMod {
func (m fsRodentlocationMods) GlobalidFunc(f func() string) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.Globalid = f
})
@ -1084,32 +1088,10 @@ func (m fsRodentlocationMods) UnsetGlobalid() FSRodentlocationMod {
// 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 fsRodentlocationMods) RandomGlobalid(f *faker.Faker) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsRodentlocationMods) RandomGlobalidNotNull(f *faker.Faker) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -54,7 +54,7 @@ type FSSamplecollectionTemplate struct {
Fieldtech func() null.Val[string]
Flockid func() null.Val[string]
Gatewaysync func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Lab func() null.Val[string]
Locationname func() null.Val[string]
LocID func() null.Val[string]
@ -195,7 +195,7 @@ func (o FSSamplecollectionTemplate) BuildSetter() *models.FSSamplecollectionSett
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Lab != nil {
val := o.Lab()
@ -521,6 +521,10 @@ func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) {
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)
@ -1577,14 +1581,14 @@ func (m fsSamplecollectionMods) RandomGatewaysyncNotNull(f *faker.Faker) FSSampl
}
// Set the model columns to this value
func (m fsSamplecollectionMods) Globalid(val null.Val[string]) FSSamplecollectionMod {
func (m fsSamplecollectionMods) Globalid(val string) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsSamplecollectionMods) GlobalidFunc(f func() null.Val[string]) FSSamplecollectionMod {
func (m fsSamplecollectionMods) GlobalidFunc(f func() string) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.Globalid = f
})
@ -1599,32 +1603,10 @@ func (m fsSamplecollectionMods) UnsetGlobalid() FSSamplecollectionMod {
// 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 fsSamplecollectionMods) RandomGlobalid(f *faker.Faker) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSamplecollectionMods) RandomGlobalidNotNull(f *faker.Faker) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSSamplelocationTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Gatewaysync func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Locationnumber func() null.Val[int64]
Name func() null.Val[string]
@ -149,7 +149,7 @@ func (o FSSamplelocationTemplate) BuildSetter() *models.FSSamplelocationSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -345,6 +345,10 @@ func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) {
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)
@ -1061,14 +1065,14 @@ func (m fsSamplelocationMods) RandomGatewaysyncNotNull(f *faker.Faker) FSSamplel
}
// Set the model columns to this value
func (m fsSamplelocationMods) Globalid(val null.Val[string]) FSSamplelocationMod {
func (m fsSamplelocationMods) Globalid(val string) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsSamplelocationMods) GlobalidFunc(f func() null.Val[string]) FSSamplelocationMod {
func (m fsSamplelocationMods) GlobalidFunc(f func() string) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.Globalid = f
})
@ -1083,32 +1087,10 @@ func (m fsSamplelocationMods) UnsetGlobalid() FSSamplelocationMod {
// 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 fsSamplelocationMods) RandomGlobalid(f *faker.Faker) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSamplelocationMods) RandomGlobalidNotNull(f *faker.Faker) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -68,7 +68,7 @@ type FSServicerequestTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Firstresponsedate func() null.Val[int64]
Globalid func() null.Val[string]
Globalid func() string
Issuesreported func() null.Val[string]
Jurisdiction func() null.Val[string]
Nextaction func() null.Val[string]
@ -118,8 +118,8 @@ type FSServicerequestTemplate struct {
Zone2 func() null.Val[string]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
GeometryY func() null.Val[float64]
GeometryX func() float64
GeometryY func() float64
LastEditedDate func() null.Val[int64]
LastEditedUser func() null.Val[string]
Dog func() null.Val[int64]
@ -291,7 +291,7 @@ func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Issuesreported != nil {
val := o.Issuesreported()
@ -491,11 +491,11 @@ func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter {
}
if o.GeometryX != nil {
val := o.GeometryX()
m.GeometryX = omitnull.FromNull(val)
m.GeometryX = omit.From(val)
}
if o.GeometryY != nil {
val := o.GeometryY()
m.GeometryY = omitnull.FromNull(val)
m.GeometryY = omit.From(val)
}
if o.LastEditedDate != nil {
val := o.LastEditedDate()
@ -841,10 +841,22 @@ func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) {
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)
}
if !(m.GeometryX.IsValue()) {
val := random_float64(nil)
m.GeometryX = omit.From(val)
}
if !(m.GeometryY.IsValue()) {
val := random_float64(nil)
m.GeometryY = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.FSServicerequest
@ -2679,14 +2691,14 @@ func (m fsServicerequestMods) RandomFirstresponsedateNotNull(f *faker.Faker) FSS
}
// Set the model columns to this value
func (m fsServicerequestMods) Globalid(val null.Val[string]) FSServicerequestMod {
func (m fsServicerequestMods) Globalid(val string) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsServicerequestMods) GlobalidFunc(f func() null.Val[string]) FSServicerequestMod {
func (m fsServicerequestMods) GlobalidFunc(f func() string) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.Globalid = f
})
@ -2701,32 +2713,10 @@ func (m fsServicerequestMods) UnsetGlobalid() FSServicerequestMod {
// 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 fsServicerequestMods) RandomGlobalid(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsServicerequestMods) RandomGlobalidNotNull(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}
@ -5307,14 +5297,14 @@ func (m fsServicerequestMods) RandomCreatedUserNotNull(f *faker.Faker) FSService
}
// Set the model columns to this value
func (m fsServicerequestMods) GeometryX(val null.Val[float64]) FSServicerequestMod {
func (m fsServicerequestMods) GeometryX(val float64) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryX = func() null.Val[float64] { return val }
o.GeometryX = func() float64 { return val }
})
}
// Set the Column from the function
func (m fsServicerequestMods) GeometryXFunc(f func() null.Val[float64]) FSServicerequestMod {
func (m fsServicerequestMods) GeometryXFunc(f func() float64) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryX = f
})
@ -5329,45 +5319,23 @@ func (m fsServicerequestMods) UnsetGeometryX() FSServicerequestMod {
// 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 fsServicerequestMods) RandomGeometryX(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
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 fsServicerequestMods) RandomGeometryXNotNull(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryX = func() null.Val[float64] {
if f == nil {
f = &defaultFaker
}
val := random_float64(f)
return null.From(val)
o.GeometryX = func() float64 {
return random_float64(f)
}
})
}
// Set the model columns to this value
func (m fsServicerequestMods) GeometryY(val null.Val[float64]) FSServicerequestMod {
func (m fsServicerequestMods) GeometryY(val float64) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryY = func() null.Val[float64] { return val }
o.GeometryY = func() float64 { return val }
})
}
// Set the Column from the function
func (m fsServicerequestMods) GeometryYFunc(f func() null.Val[float64]) FSServicerequestMod {
func (m fsServicerequestMods) GeometryYFunc(f func() float64) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryY = f
})
@ -5382,32 +5350,10 @@ func (m fsServicerequestMods) UnsetGeometryY() FSServicerequestMod {
// 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 fsServicerequestMods) RandomGeometryY(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
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 fsServicerequestMods) RandomGeometryYNotNull(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.GeometryY = func() null.Val[float64] {
if f == nil {
f = &defaultFaker
}
val := random_float64(f)
return null.From(val)
o.GeometryY = func() float64 {
return random_float64(f)
}
})
}

View file

@ -46,7 +46,7 @@ type FSSpeciesabundanceTemplate struct {
Editor func() null.Val[string]
Females func() null.Val[int64]
Gravidfem func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Larvae func() null.Val[int16]
Males func() null.Val[int16]
Objectid func() int32
@ -146,7 +146,7 @@ func (o FSSpeciesabundanceTemplate) BuildSetter() *models.FSSpeciesabundanceSett
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Larvae != nil {
val := o.Larvae()
@ -385,6 +385,10 @@ func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) {
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)
@ -1000,14 +1004,14 @@ func (m fsSpeciesabundanceMods) RandomGravidfemNotNull(f *faker.Faker) FSSpecies
}
// Set the model columns to this value
func (m fsSpeciesabundanceMods) Globalid(val null.Val[string]) FSSpeciesabundanceMod {
func (m fsSpeciesabundanceMods) Globalid(val string) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsSpeciesabundanceMods) GlobalidFunc(f func() null.Val[string]) FSSpeciesabundanceMod {
func (m fsSpeciesabundanceMods) GlobalidFunc(f func() string) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.Globalid = f
})
@ -1022,32 +1026,10 @@ func (m fsSpeciesabundanceMods) UnsetGlobalid() FSSpeciesabundanceMod {
// 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 fsSpeciesabundanceMods) RandomGlobalid(f *faker.Faker) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSpeciesabundanceMods) RandomGlobalidNotNull(f *faker.Faker) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -42,7 +42,7 @@ type FSStormdrainTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Jurisdiction func() null.Val[string]
Lastaction func() null.Val[string]
Laststatus func() null.Val[string]
@ -120,7 +120,7 @@ func (o FSStormdrainTemplate) BuildSetter() *models.FSStormdrainSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Jurisdiction != nil {
val := o.Jurisdiction()
@ -305,6 +305,10 @@ func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) {
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)
@ -698,14 +702,14 @@ func (m fsStormdrainMods) RandomEditorNotNull(f *faker.Faker) FSStormdrainMod {
}
// Set the model columns to this value
func (m fsStormdrainMods) Globalid(val null.Val[string]) FSStormdrainMod {
func (m fsStormdrainMods) Globalid(val string) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsStormdrainMods) GlobalidFunc(f func() null.Val[string]) FSStormdrainMod {
func (m fsStormdrainMods) GlobalidFunc(f func() string) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.Globalid = f
})
@ -720,32 +724,10 @@ func (m fsStormdrainMods) UnsetGlobalid() FSStormdrainMod {
// 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 fsStormdrainMods) RandomGlobalid(f *faker.Faker) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsStormdrainMods) RandomGlobalidNotNull(f *faker.Faker) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSTimecardTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Fieldtech func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Lclocid func() null.Val[string]
Linelocid func() null.Val[string]
Locationname func() null.Val[string]
@ -153,7 +153,7 @@ func (o FSTimecardTemplate) BuildSetter() *models.FSTimecardSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Lclocid != nil {
val := o.Lclocid()
@ -377,6 +377,10 @@ func ensureCreatableFSTimecard(m *models.FSTimecardSetter) {
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)
@ -1097,14 +1101,14 @@ func (m fsTimecardMods) RandomFieldtechNotNull(f *faker.Faker) FSTimecardMod {
}
// Set the model columns to this value
func (m fsTimecardMods) Globalid(val null.Val[string]) FSTimecardMod {
func (m fsTimecardMods) Globalid(val string) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsTimecardMods) GlobalidFunc(f func() null.Val[string]) FSTimecardMod {
func (m fsTimecardMods) GlobalidFunc(f func() string) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.Globalid = f
})
@ -1119,32 +1123,10 @@ func (m fsTimecardMods) UnsetGlobalid() FSTimecardMod {
// 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 fsTimecardMods) RandomGlobalid(f *faker.Faker) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTimecardMods) RandomGlobalidNotNull(f *faker.Faker) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSTrapdatumTemplate struct {
Fieldtech func() null.Val[string]
Field func() null.Val[int64]
Gatewaysync func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Idbytech func() null.Val[string]
Locationname func() null.Val[string]
LocID func() null.Val[string]
@ -167,7 +167,7 @@ func (o FSTrapdatumTemplate) BuildSetter() *models.FSTrapdatumSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Idbytech != nil {
val := o.Idbytech()
@ -489,6 +489,10 @@ func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) {
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)
@ -1223,14 +1227,14 @@ func (m fsTrapdatumMods) RandomGatewaysyncNotNull(f *faker.Faker) FSTrapdatumMod
}
// Set the model columns to this value
func (m fsTrapdatumMods) Globalid(val null.Val[string]) FSTrapdatumMod {
func (m fsTrapdatumMods) Globalid(val string) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsTrapdatumMods) GlobalidFunc(f func() null.Val[string]) FSTrapdatumMod {
func (m fsTrapdatumMods) GlobalidFunc(f func() string) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.Globalid = f
})
@ -1245,32 +1249,10 @@ func (m fsTrapdatumMods) UnsetGlobalid() FSTrapdatumMod {
// 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 fsTrapdatumMods) RandomGlobalid(f *faker.Faker) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTrapdatumMods) RandomGlobalidNotNull(f *faker.Faker) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -48,7 +48,7 @@ type FSTraplocationTemplate struct {
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Gatewaysync func() null.Val[int16]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
Locationnumber func() null.Val[int64]
Name func() null.Val[string]
@ -155,7 +155,7 @@ func (o FSTraplocationTemplate) BuildSetter() *models.FSTraplocationSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -393,6 +393,10 @@ func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) {
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)
@ -1115,14 +1119,14 @@ func (m fsTraplocationMods) RandomGatewaysyncNotNull(f *faker.Faker) FSTraplocat
}
// Set the model columns to this value
func (m fsTraplocationMods) Globalid(val null.Val[string]) FSTraplocationMod {
func (m fsTraplocationMods) Globalid(val string) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsTraplocationMods) GlobalidFunc(f func() null.Val[string]) FSTraplocationMod {
func (m fsTraplocationMods) GlobalidFunc(f func() string) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.Globalid = f
})
@ -1137,32 +1141,10 @@ func (m fsTraplocationMods) UnsetGlobalid() FSTraplocationMod {
// 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 fsTraplocationMods) RandomGlobalid(f *faker.Faker) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTraplocationMods) RandomGlobalidNotNull(f *faker.Faker) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -53,7 +53,7 @@ type FSTreatmentTemplate struct {
Editor func() null.Val[string]
Fieldtech func() null.Val[string]
Flowrate func() null.Val[float64]
Globalid func() null.Val[string]
Globalid func() string
Habitat func() null.Val[string]
InspID func() null.Val[string]
Invloc func() null.Val[string]
@ -199,7 +199,7 @@ func (o FSTreatmentTemplate) BuildSetter() *models.FSTreatmentSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Habitat != nil {
val := o.Habitat()
@ -585,6 +585,10 @@ func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) {
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)
@ -1596,14 +1600,14 @@ func (m fsTreatmentMods) RandomFlowrateNotNull(f *faker.Faker) FSTreatmentMod {
}
// Set the model columns to this value
func (m fsTreatmentMods) Globalid(val null.Val[string]) FSTreatmentMod {
func (m fsTreatmentMods) Globalid(val string) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsTreatmentMods) GlobalidFunc(f func() null.Val[string]) FSTreatmentMod {
func (m fsTreatmentMods) GlobalidFunc(f func() string) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.Globalid = f
})
@ -1618,32 +1622,10 @@ func (m fsTreatmentMods) UnsetGlobalid() FSTreatmentMod {
// 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 fsTreatmentMods) RandomGlobalid(f *faker.Faker) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTreatmentMods) RandomGlobalidNotNull(f *faker.Faker) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -43,7 +43,7 @@ type FSTreatmentareaTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Notified func() null.Val[int16]
Objectid func() int32
SessionID func() null.Val[string]
@ -123,7 +123,7 @@ func (o FSTreatmentareaTemplate) BuildSetter() *models.FSTreatmentareaSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Notified != nil {
val := o.Notified()
@ -297,6 +297,10 @@ func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) {
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)
@ -742,14 +746,14 @@ func (m fsTreatmentareaMods) RandomEditorNotNull(f *faker.Faker) FSTreatmentarea
}
// Set the model columns to this value
func (m fsTreatmentareaMods) Globalid(val null.Val[string]) FSTreatmentareaMod {
func (m fsTreatmentareaMods) Globalid(val string) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsTreatmentareaMods) GlobalidFunc(f func() null.Val[string]) FSTreatmentareaMod {
func (m fsTreatmentareaMods) GlobalidFunc(f func() string) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.Globalid = f
})
@ -764,32 +768,10 @@ func (m fsTreatmentareaMods) UnsetGlobalid() FSTreatmentareaMod {
// 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 fsTreatmentareaMods) RandomGlobalid(f *faker.Faker) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTreatmentareaMods) RandomGlobalidNotNull(f *faker.Faker) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -43,7 +43,7 @@ type FSZoneTemplate struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Name func() null.Val[string]
Objectid func() int32
ShapeArea func() null.Val[float64]
@ -119,7 +119,7 @@ func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Name != nil {
val := o.Name()
@ -265,6 +265,10 @@ func ensureCreatableFSZone(m *models.FSZoneSetter) {
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)
@ -706,14 +710,14 @@ func (m fsZoneMods) RandomEditorNotNull(f *faker.Faker) FSZoneMod {
}
// Set the model columns to this value
func (m fsZoneMods) Globalid(val null.Val[string]) FSZoneMod {
func (m fsZoneMods) Globalid(val string) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) GlobalidFunc(f func() null.Val[string]) FSZoneMod {
func (m fsZoneMods) GlobalidFunc(f func() string) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = f
})
@ -728,32 +732,10 @@ func (m fsZoneMods) UnsetGlobalid() FSZoneMod {
// 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 fsZoneMods) RandomGlobalid(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsZoneMods) RandomGlobalidNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -42,7 +42,7 @@ type FSZones2Template struct {
Creator func() null.Val[string]
Editdate func() null.Val[int64]
Editor func() null.Val[string]
Globalid func() null.Val[string]
Globalid func() string
Name func() null.Val[string]
Objectid func() int32
ShapeArea func() null.Val[float64]
@ -114,7 +114,7 @@ func (o FSZones2Template) BuildSetter() *models.FSZones2Setter {
}
if o.Globalid != nil {
val := o.Globalid()
m.Globalid = omitnull.FromNull(val)
m.Globalid = omit.From(val)
}
if o.Name != nil {
val := o.Name()
@ -257,6 +257,10 @@ func ensureCreatableFSZones2(m *models.FSZones2Setter) {
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)
@ -644,14 +648,14 @@ func (m fsZones2Mods) RandomEditorNotNull(f *faker.Faker) FSZones2Mod {
}
// Set the model columns to this value
func (m fsZones2Mods) Globalid(val null.Val[string]) FSZones2Mod {
func (m fsZones2Mods) Globalid(val string) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.Globalid = func() null.Val[string] { return val }
o.Globalid = func() string { return val }
})
}
// Set the Column from the function
func (m fsZones2Mods) GlobalidFunc(f func() null.Val[string]) FSZones2Mod {
func (m fsZones2Mods) GlobalidFunc(f func() string) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.Globalid = f
})
@ -666,32 +670,10 @@ func (m fsZones2Mods) UnsetGlobalid() FSZones2Mod {
// 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 fsZones2Mods) RandomGlobalid(f *faker.Faker) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsZones2Mods) RandomGlobalidNotNull(f *faker.Faker) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.Globalid = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
o.Globalid = func() string {
return random_string(f)
}
})
}

View file

@ -0,0 +1,500 @@
// 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/models"
"github.com/aarondl/opt/null"
"github.com/jaswdr/faker/v2"
)
type GeographyColumnMod interface {
Apply(context.Context, *GeographyColumnTemplate)
}
type GeographyColumnModFunc func(context.Context, *GeographyColumnTemplate)
func (f GeographyColumnModFunc) Apply(ctx context.Context, n *GeographyColumnTemplate) {
f(ctx, n)
}
type GeographyColumnModSlice []GeographyColumnMod
func (mods GeographyColumnModSlice) Apply(ctx context.Context, n *GeographyColumnTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// GeographyColumnTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type GeographyColumnTemplate struct {
FTableCatalog func() null.Val[string]
FTableSchema func() null.Val[string]
FTableName func() null.Val[string]
FGeographyColumn func() null.Val[string]
CoordDimension func() null.Val[int32]
Srid func() null.Val[int32]
Type func() null.Val[string]
f *Factory
alreadyPersisted bool
}
// Apply mods to the GeographyColumnTemplate
func (o *GeographyColumnTemplate) Apply(ctx context.Context, mods ...GeographyColumnMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.GeographyColumn
// according to the relationships in the template. Nothing is inserted into the db
func (t GeographyColumnTemplate) setModelRels(o *models.GeographyColumn) {}
// Build returns an *models.GeographyColumn
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use GeographyColumnTemplate.Create
func (o GeographyColumnTemplate) Build() *models.GeographyColumn {
m := &models.GeographyColumn{}
if o.FTableCatalog != nil {
m.FTableCatalog = o.FTableCatalog()
}
if o.FTableSchema != nil {
m.FTableSchema = o.FTableSchema()
}
if o.FTableName != nil {
m.FTableName = o.FTableName()
}
if o.FGeographyColumn != nil {
m.FGeographyColumn = o.FGeographyColumn()
}
if o.CoordDimension != nil {
m.CoordDimension = o.CoordDimension()
}
if o.Srid != nil {
m.Srid = o.Srid()
}
if o.Type != nil {
m.Type = o.Type()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.GeographyColumnSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use GeographyColumnTemplate.CreateMany
func (o GeographyColumnTemplate) BuildMany(number int) models.GeographyColumnSlice {
m := make(models.GeographyColumnSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
// GeographyColumn has methods that act as mods for the GeographyColumnTemplate
var GeographyColumnMods geographyColumnMods
type geographyColumnMods struct{}
func (m geographyColumnMods) RandomizeAllColumns(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModSlice{
GeographyColumnMods.RandomFTableCatalog(f),
GeographyColumnMods.RandomFTableSchema(f),
GeographyColumnMods.RandomFTableName(f),
GeographyColumnMods.RandomFGeographyColumn(f),
GeographyColumnMods.RandomCoordDimension(f),
GeographyColumnMods.RandomSrid(f),
GeographyColumnMods.RandomType(f),
}
}
// Set the model columns to this value
func (m geographyColumnMods) FTableCatalog(val null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableCatalog = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) FTableCatalogFunc(f func() null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableCatalog = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetFTableCatalog() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableCatalog = 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 geographyColumnMods) RandomFTableCatalog(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableCatalog = 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 geographyColumnMods) RandomFTableCatalogNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableCatalog = 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 geographyColumnMods) FTableSchema(val null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableSchema = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) FTableSchemaFunc(f func() null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableSchema = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetFTableSchema() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableSchema = 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 geographyColumnMods) RandomFTableSchema(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableSchema = 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 geographyColumnMods) RandomFTableSchemaNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableSchema = 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 geographyColumnMods) FTableName(val null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableName = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) FTableNameFunc(f func() null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableName = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetFTableName() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableName = 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 geographyColumnMods) RandomFTableName(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableName = 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 geographyColumnMods) RandomFTableNameNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FTableName = 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 geographyColumnMods) FGeographyColumn(val null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FGeographyColumn = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) FGeographyColumnFunc(f func() null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FGeographyColumn = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetFGeographyColumn() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FGeographyColumn = 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 geographyColumnMods) RandomFGeographyColumn(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FGeographyColumn = 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 geographyColumnMods) RandomFGeographyColumnNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.FGeographyColumn = 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 geographyColumnMods) CoordDimension(val null.Val[int32]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.CoordDimension = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) CoordDimensionFunc(f func() null.Val[int32]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.CoordDimension = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetCoordDimension() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.CoordDimension = 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 geographyColumnMods) RandomCoordDimension(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.CoordDimension = 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 geographyColumnMods) RandomCoordDimensionNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.CoordDimension = 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 geographyColumnMods) Srid(val null.Val[int32]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Srid = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) SridFunc(f func() null.Val[int32]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Srid = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetSrid() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Srid = 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 geographyColumnMods) RandomSrid(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Srid = 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 geographyColumnMods) RandomSridNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Srid = 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 geographyColumnMods) Type(val null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Type = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geographyColumnMods) TypeFunc(f func() null.Val[string]) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Type = f
})
}
// Clear any values for the column
func (m geographyColumnMods) UnsetType() GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Type = 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 geographyColumnMods) RandomType(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Type = 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 geographyColumnMods) RandomTypeNotNull(f *faker.Faker) GeographyColumnMod {
return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) {
o.Type = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
func (m geographyColumnMods) WithParentsCascading() GeographyColumnMod {
return GeographyColumnModFunc(func(ctx context.Context, o *GeographyColumnTemplate) {
if isDone, _ := geographyColumnWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = geographyColumnWithParentsCascadingCtx.WithValue(ctx, true)
})
}

View file

@ -0,0 +1,500 @@
// 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/models"
"github.com/aarondl/opt/null"
"github.com/jaswdr/faker/v2"
)
type GeometryColumnMod interface {
Apply(context.Context, *GeometryColumnTemplate)
}
type GeometryColumnModFunc func(context.Context, *GeometryColumnTemplate)
func (f GeometryColumnModFunc) Apply(ctx context.Context, n *GeometryColumnTemplate) {
f(ctx, n)
}
type GeometryColumnModSlice []GeometryColumnMod
func (mods GeometryColumnModSlice) Apply(ctx context.Context, n *GeometryColumnTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// GeometryColumnTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type GeometryColumnTemplate struct {
FTableCatalog func() null.Val[string]
FTableSchema func() null.Val[string]
FTableName func() null.Val[string]
FGeometryColumn func() null.Val[string]
CoordDimension func() null.Val[int32]
Srid func() null.Val[int32]
Type func() null.Val[string]
f *Factory
alreadyPersisted bool
}
// Apply mods to the GeometryColumnTemplate
func (o *GeometryColumnTemplate) Apply(ctx context.Context, mods ...GeometryColumnMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.GeometryColumn
// according to the relationships in the template. Nothing is inserted into the db
func (t GeometryColumnTemplate) setModelRels(o *models.GeometryColumn) {}
// Build returns an *models.GeometryColumn
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use GeometryColumnTemplate.Create
func (o GeometryColumnTemplate) Build() *models.GeometryColumn {
m := &models.GeometryColumn{}
if o.FTableCatalog != nil {
m.FTableCatalog = o.FTableCatalog()
}
if o.FTableSchema != nil {
m.FTableSchema = o.FTableSchema()
}
if o.FTableName != nil {
m.FTableName = o.FTableName()
}
if o.FGeometryColumn != nil {
m.FGeometryColumn = o.FGeometryColumn()
}
if o.CoordDimension != nil {
m.CoordDimension = o.CoordDimension()
}
if o.Srid != nil {
m.Srid = o.Srid()
}
if o.Type != nil {
m.Type = o.Type()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.GeometryColumnSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use GeometryColumnTemplate.CreateMany
func (o GeometryColumnTemplate) BuildMany(number int) models.GeometryColumnSlice {
m := make(models.GeometryColumnSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
// GeometryColumn has methods that act as mods for the GeometryColumnTemplate
var GeometryColumnMods geometryColumnMods
type geometryColumnMods struct{}
func (m geometryColumnMods) RandomizeAllColumns(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModSlice{
GeometryColumnMods.RandomFTableCatalog(f),
GeometryColumnMods.RandomFTableSchema(f),
GeometryColumnMods.RandomFTableName(f),
GeometryColumnMods.RandomFGeometryColumn(f),
GeometryColumnMods.RandomCoordDimension(f),
GeometryColumnMods.RandomSrid(f),
GeometryColumnMods.RandomType(f),
}
}
// Set the model columns to this value
func (m geometryColumnMods) FTableCatalog(val null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableCatalog = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) FTableCatalogFunc(f func() null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableCatalog = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetFTableCatalog() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableCatalog = 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 geometryColumnMods) RandomFTableCatalog(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableCatalog = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "256")
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 geometryColumnMods) RandomFTableCatalogNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableCatalog = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "256")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m geometryColumnMods) FTableSchema(val null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableSchema = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) FTableSchemaFunc(f func() null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableSchema = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetFTableSchema() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableSchema = 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 geometryColumnMods) RandomFTableSchema(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableSchema = 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 geometryColumnMods) RandomFTableSchemaNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableSchema = 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 geometryColumnMods) FTableName(val null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableName = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) FTableNameFunc(f func() null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableName = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetFTableName() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableName = 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 geometryColumnMods) RandomFTableName(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableName = 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 geometryColumnMods) RandomFTableNameNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FTableName = 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 geometryColumnMods) FGeometryColumn(val null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FGeometryColumn = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) FGeometryColumnFunc(f func() null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FGeometryColumn = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetFGeometryColumn() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FGeometryColumn = 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 geometryColumnMods) RandomFGeometryColumn(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FGeometryColumn = 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 geometryColumnMods) RandomFGeometryColumnNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.FGeometryColumn = 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 geometryColumnMods) CoordDimension(val null.Val[int32]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.CoordDimension = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) CoordDimensionFunc(f func() null.Val[int32]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.CoordDimension = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetCoordDimension() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.CoordDimension = 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 geometryColumnMods) RandomCoordDimension(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.CoordDimension = 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 geometryColumnMods) RandomCoordDimensionNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.CoordDimension = 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 geometryColumnMods) Srid(val null.Val[int32]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Srid = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) SridFunc(f func() null.Val[int32]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Srid = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetSrid() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Srid = 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 geometryColumnMods) RandomSrid(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Srid = 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 geometryColumnMods) RandomSridNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Srid = 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 geometryColumnMods) Type(val null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Type = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m geometryColumnMods) TypeFunc(f func() null.Val[string]) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Type = f
})
}
// Clear any values for the column
func (m geometryColumnMods) UnsetType() GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Type = 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 geometryColumnMods) RandomType(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Type = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "30")
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 geometryColumnMods) RandomTypeNotNull(f *faker.Faker) GeometryColumnMod {
return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) {
o.Type = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "30")
return null.From(val)
}
})
}
func (m geometryColumnMods) WithParentsCascading() GeometryColumnMod {
return GeometryColumnModFunc(func(ctx context.Context, o *GeometryColumnTemplate) {
if isDone, _ := geometryColumnWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = geometryColumnWithParentsCascadingCtx.WithValue(ctx, true)
})
}

View file

@ -0,0 +1,542 @@
// 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"
enums "github.com/Gleipnir-Technology/nidus-sync/enums"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/omit"
"github.com/jaswdr/faker/v2"
"github.com/stephenafamo/bob"
)
type H3AggregationMod interface {
Apply(context.Context, *H3AggregationTemplate)
}
type H3AggregationModFunc func(context.Context, *H3AggregationTemplate)
func (f H3AggregationModFunc) Apply(ctx context.Context, n *H3AggregationTemplate) {
f(ctx, n)
}
type H3AggregationModSlice []H3AggregationMod
func (mods H3AggregationModSlice) Apply(ctx context.Context, n *H3AggregationTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// H3AggregationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type H3AggregationTemplate struct {
ID func() int32
Cell func() string
Resolution func() int32
Count func() int32
Type func() enums.H3aggregationtype
OrganizationID func() int32
r h3AggregationR
f *Factory
alreadyPersisted bool
}
type h3AggregationR struct {
Organization *h3AggregationROrganizationR
}
type h3AggregationROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the H3AggregationTemplate
func (o *H3AggregationTemplate) Apply(ctx context.Context, mods ...H3AggregationMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.H3Aggregation
// according to the relationships in the template. Nothing is inserted into the db
func (t H3AggregationTemplate) setModelRels(o *models.H3Aggregation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.H3Aggregations = append(rel.R.H3Aggregations, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.H3AggregationSetter
// this does nothing with the relationship templates
func (o H3AggregationTemplate) BuildSetter() *models.H3AggregationSetter {
m := &models.H3AggregationSetter{}
if o.ID != nil {
val := o.ID()
m.ID = omit.From(val)
}
if o.Cell != nil {
val := o.Cell()
m.Cell = omit.From(val)
}
if o.Resolution != nil {
val := o.Resolution()
m.Resolution = omit.From(val)
}
if o.Count != nil {
val := o.Count()
m.Count = omit.From(val)
}
if o.Type != nil {
val := o.Type()
m.Type = omit.From(val)
}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omit.From(val)
}
return m
}
// BuildManySetter returns an []*models.H3AggregationSetter
// this does nothing with the relationship templates
func (o H3AggregationTemplate) BuildManySetter(number int) []*models.H3AggregationSetter {
m := make([]*models.H3AggregationSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.H3Aggregation
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use H3AggregationTemplate.Create
func (o H3AggregationTemplate) Build() *models.H3Aggregation {
m := &models.H3Aggregation{}
if o.ID != nil {
m.ID = o.ID()
}
if o.Cell != nil {
m.Cell = o.Cell()
}
if o.Resolution != nil {
m.Resolution = o.Resolution()
}
if o.Count != nil {
m.Count = o.Count()
}
if o.Type != nil {
m.Type = o.Type()
}
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.H3AggregationSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use H3AggregationTemplate.CreateMany
func (o H3AggregationTemplate) BuildMany(number int) models.H3AggregationSlice {
m := make(models.H3AggregationSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableH3Aggregation(m *models.H3AggregationSetter) {
if !(m.Cell.IsValue()) {
val := random_string(nil)
m.Cell = omit.From(val)
}
if !(m.Resolution.IsValue()) {
val := random_int32(nil)
m.Resolution = omit.From(val)
}
if !(m.Count.IsValue()) {
val := random_int32(nil)
m.Count = omit.From(val)
}
if !(m.Type.IsValue()) {
val := random_enums_H3aggregationtype(nil)
m.Type = omit.From(val)
}
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.H3Aggregation
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *H3AggregationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.H3Aggregation) error {
var err error
return err
}
// Create builds a h3Aggregation and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *H3AggregationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.H3Aggregation, error) {
var err error
opt := o.BuildSetter()
ensureCreatableH3Aggregation(opt)
if o.r.Organization == nil {
H3AggregationMods.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.H3Aggregations.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 h3Aggregation and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *H3AggregationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.H3Aggregation {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a h3Aggregation 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 *H3AggregationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.H3Aggregation {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple h3Aggregations and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o H3AggregationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.H3AggregationSlice, error) {
var err error
m := make(models.H3AggregationSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple h3Aggregations and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o H3AggregationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.H3AggregationSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple h3Aggregations 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 H3AggregationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.H3AggregationSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// H3Aggregation has methods that act as mods for the H3AggregationTemplate
var H3AggregationMods h3AggregationMods
type h3AggregationMods struct{}
func (m h3AggregationMods) RandomizeAllColumns(f *faker.Faker) H3AggregationMod {
return H3AggregationModSlice{
H3AggregationMods.RandomID(f),
H3AggregationMods.RandomCell(f),
H3AggregationMods.RandomResolution(f),
H3AggregationMods.RandomCount(f),
H3AggregationMods.RandomType(f),
H3AggregationMods.RandomOrganizationID(f),
}
}
// Set the model columns to this value
func (m h3AggregationMods) ID(val int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.ID = func() int32 { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) IDFunc(f func() int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.ID = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetID() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
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 h3AggregationMods) RandomID(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.ID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m h3AggregationMods) Cell(val string) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Cell = func() string { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) CellFunc(f func() string) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Cell = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetCell() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Cell = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m h3AggregationMods) RandomCell(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Cell = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m h3AggregationMods) Resolution(val int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Resolution = func() int32 { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) ResolutionFunc(f func() int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Resolution = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetResolution() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Resolution = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m h3AggregationMods) RandomResolution(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Resolution = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m h3AggregationMods) Count(val int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Count = func() int32 { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) CountFunc(f func() int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Count = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetCount() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Count = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m h3AggregationMods) RandomCount(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Count = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m h3AggregationMods) Type(val enums.H3aggregationtype) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Type = func() enums.H3aggregationtype { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) TypeFunc(f func() enums.H3aggregationtype) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Type = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetType() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Type = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m h3AggregationMods) RandomType(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.Type = func() enums.H3aggregationtype {
return random_enums_H3aggregationtype(f)
}
})
}
// Set the model columns to this value
func (m h3AggregationMods) OrganizationID(val int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m h3AggregationMods) OrganizationIDFunc(f func() int32) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m h3AggregationMods) UnsetOrganizationID() H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
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 h3AggregationMods) RandomOrganizationID(f *faker.Faker) H3AggregationMod {
return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
func (m h3AggregationMods) WithParentsCascading() H3AggregationMod {
return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) {
if isDone, _ := h3AggregationWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = h3AggregationWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m h3AggregationMods) WithOrganization(rel *OrganizationTemplate) H3AggregationMod {
return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) {
o.r.Organization = &h3AggregationROrganizationR{
o: rel,
}
})
}
func (m h3AggregationMods) WithNewOrganization(mods ...OrganizationMod) H3AggregationMod {
return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m h3AggregationMods) WithExistingOrganization(em *models.Organization) H3AggregationMod {
return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) {
o.r.Organization = &h3AggregationROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m h3AggregationMods) WithoutOrganization() H3AggregationMod {
return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) {
o.r.Organization = nil
})
}

View file

@ -77,6 +77,7 @@ type organizationR struct {
FSTreatmentareas []*organizationRFSTreatmentareasR
FSZones []*organizationRFSZonesR
FSZones2s []*organizationRFSZones2sR
H3Aggregations []*organizationRH3AggregationsR
HistoryContainerrelates []*organizationRHistoryContainerrelatesR
HistoryFieldscoutinglogs []*organizationRHistoryFieldscoutinglogsR
HistoryHabitatrelates []*organizationRHistoryHabitatrelatesR
@ -219,6 +220,10 @@ type organizationRFSZones2sR struct {
number int
o *FSZones2Template
}
type organizationRH3AggregationsR struct {
number int
o *H3AggregationTemplate
}
type organizationRHistoryContainerrelatesR struct {
number int
o *HistoryContainerrelateTemplate
@ -706,6 +711,19 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) {
o.R.FSZones2s = rel
}
if t.r.H3Aggregations != nil {
rel := models.H3AggregationSlice{}
for _, r := range t.r.H3Aggregations {
related := r.o.BuildMany(r.number)
for _, rel := range related {
rel.OrganizationID = o.ID // h2
rel.R.Organization = o
}
rel = append(rel, related...)
}
o.R.H3Aggregations = rel
}
if t.r.HistoryContainerrelates != nil {
rel := models.HistoryContainerrelateSlice{}
for _, r := range t.r.HistoryContainerrelates {
@ -1721,6 +1739,26 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
}
}
isH3AggregationsDone, _ := organizationRelH3AggregationsCtx.Value(ctx)
if !isH3AggregationsDone && o.r.H3Aggregations != nil {
ctx = organizationRelH3AggregationsCtx.WithValue(ctx, true)
for _, r := range o.r.H3Aggregations {
if r.o.alreadyPersisted {
m.R.H3Aggregations = append(m.R.H3Aggregations, r.o.Build())
} else {
rel28, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachH3Aggregations(ctx, exec, rel28...)
if err != nil {
return err
}
}
}
}
isHistoryContainerrelatesDone, _ := organizationRelHistoryContainerrelatesCtx.Value(ctx)
if !isHistoryContainerrelatesDone && o.r.HistoryContainerrelates != nil {
ctx = organizationRelHistoryContainerrelatesCtx.WithValue(ctx, true)
@ -1728,12 +1766,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryContainerrelates = append(m.R.HistoryContainerrelates, r.o.Build())
} else {
rel28, err := r.o.CreateMany(ctx, exec, r.number)
rel29, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryContainerrelates(ctx, exec, rel28...)
err = m.AttachHistoryContainerrelates(ctx, exec, rel29...)
if err != nil {
return err
}
@ -1748,12 +1786,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryFieldscoutinglogs = append(m.R.HistoryFieldscoutinglogs, r.o.Build())
} else {
rel29, err := r.o.CreateMany(ctx, exec, r.number)
rel30, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel29...)
err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel30...)
if err != nil {
return err
}
@ -1768,12 +1806,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryHabitatrelates = append(m.R.HistoryHabitatrelates, r.o.Build())
} else {
rel30, err := r.o.CreateMany(ctx, exec, r.number)
rel31, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryHabitatrelates(ctx, exec, rel30...)
err = m.AttachHistoryHabitatrelates(ctx, exec, rel31...)
if err != nil {
return err
}
@ -1788,12 +1826,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryInspectionsamples = append(m.R.HistoryInspectionsamples, r.o.Build())
} else {
rel31, err := r.o.CreateMany(ctx, exec, r.number)
rel32, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryInspectionsamples(ctx, exec, rel31...)
err = m.AttachHistoryInspectionsamples(ctx, exec, rel32...)
if err != nil {
return err
}
@ -1808,12 +1846,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryInspectionsampledetails = append(m.R.HistoryInspectionsampledetails, r.o.Build())
} else {
rel32, err := r.o.CreateMany(ctx, exec, r.number)
rel33, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel32...)
err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel33...)
if err != nil {
return err
}
@ -1828,12 +1866,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryLinelocations = append(m.R.HistoryLinelocations, r.o.Build())
} else {
rel33, err := r.o.CreateMany(ctx, exec, r.number)
rel34, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryLinelocations(ctx, exec, rel33...)
err = m.AttachHistoryLinelocations(ctx, exec, rel34...)
if err != nil {
return err
}
@ -1848,12 +1886,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryLocationtrackings = append(m.R.HistoryLocationtrackings, r.o.Build())
} else {
rel34, err := r.o.CreateMany(ctx, exec, r.number)
rel35, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryLocationtrackings(ctx, exec, rel34...)
err = m.AttachHistoryLocationtrackings(ctx, exec, rel35...)
if err != nil {
return err
}
@ -1868,12 +1906,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryMosquitoinspections = append(m.R.HistoryMosquitoinspections, r.o.Build())
} else {
rel35, err := r.o.CreateMany(ctx, exec, r.number)
rel36, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryMosquitoinspections(ctx, exec, rel35...)
err = m.AttachHistoryMosquitoinspections(ctx, exec, rel36...)
if err != nil {
return err
}
@ -1888,12 +1926,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryPointlocations = append(m.R.HistoryPointlocations, r.o.Build())
} else {
rel36, err := r.o.CreateMany(ctx, exec, r.number)
rel37, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryPointlocations(ctx, exec, rel36...)
err = m.AttachHistoryPointlocations(ctx, exec, rel37...)
if err != nil {
return err
}
@ -1908,12 +1946,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryPolygonlocations = append(m.R.HistoryPolygonlocations, r.o.Build())
} else {
rel37, err := r.o.CreateMany(ctx, exec, r.number)
rel38, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryPolygonlocations(ctx, exec, rel37...)
err = m.AttachHistoryPolygonlocations(ctx, exec, rel38...)
if err != nil {
return err
}
@ -1928,12 +1966,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryPools = append(m.R.HistoryPools, r.o.Build())
} else {
rel38, err := r.o.CreateMany(ctx, exec, r.number)
rel39, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryPools(ctx, exec, rel38...)
err = m.AttachHistoryPools(ctx, exec, rel39...)
if err != nil {
return err
}
@ -1948,12 +1986,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryPooldetails = append(m.R.HistoryPooldetails, r.o.Build())
} else {
rel39, err := r.o.CreateMany(ctx, exec, r.number)
rel40, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryPooldetails(ctx, exec, rel39...)
err = m.AttachHistoryPooldetails(ctx, exec, rel40...)
if err != nil {
return err
}
@ -1968,12 +2006,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryProposedtreatmentareas = append(m.R.HistoryProposedtreatmentareas, r.o.Build())
} else {
rel40, err := r.o.CreateMany(ctx, exec, r.number)
rel41, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel40...)
err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel41...)
if err != nil {
return err
}
@ -1988,12 +2026,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryQamosquitoinspections = append(m.R.HistoryQamosquitoinspections, r.o.Build())
} else {
rel41, err := r.o.CreateMany(ctx, exec, r.number)
rel42, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel41...)
err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel42...)
if err != nil {
return err
}
@ -2008,12 +2046,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryRodentlocations = append(m.R.HistoryRodentlocations, r.o.Build())
} else {
rel42, err := r.o.CreateMany(ctx, exec, r.number)
rel43, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryRodentlocations(ctx, exec, rel42...)
err = m.AttachHistoryRodentlocations(ctx, exec, rel43...)
if err != nil {
return err
}
@ -2028,12 +2066,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistorySamplecollections = append(m.R.HistorySamplecollections, r.o.Build())
} else {
rel43, err := r.o.CreateMany(ctx, exec, r.number)
rel44, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistorySamplecollections(ctx, exec, rel43...)
err = m.AttachHistorySamplecollections(ctx, exec, rel44...)
if err != nil {
return err
}
@ -2048,12 +2086,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistorySamplelocations = append(m.R.HistorySamplelocations, r.o.Build())
} else {
rel44, err := r.o.CreateMany(ctx, exec, r.number)
rel45, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistorySamplelocations(ctx, exec, rel44...)
err = m.AttachHistorySamplelocations(ctx, exec, rel45...)
if err != nil {
return err
}
@ -2068,12 +2106,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryServicerequests = append(m.R.HistoryServicerequests, r.o.Build())
} else {
rel45, err := r.o.CreateMany(ctx, exec, r.number)
rel46, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryServicerequests(ctx, exec, rel45...)
err = m.AttachHistoryServicerequests(ctx, exec, rel46...)
if err != nil {
return err
}
@ -2088,12 +2126,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistorySpeciesabundances = append(m.R.HistorySpeciesabundances, r.o.Build())
} else {
rel46, err := r.o.CreateMany(ctx, exec, r.number)
rel47, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistorySpeciesabundances(ctx, exec, rel46...)
err = m.AttachHistorySpeciesabundances(ctx, exec, rel47...)
if err != nil {
return err
}
@ -2108,12 +2146,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryStormdrains = append(m.R.HistoryStormdrains, r.o.Build())
} else {
rel47, err := r.o.CreateMany(ctx, exec, r.number)
rel48, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryStormdrains(ctx, exec, rel47...)
err = m.AttachHistoryStormdrains(ctx, exec, rel48...)
if err != nil {
return err
}
@ -2128,12 +2166,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryTimecards = append(m.R.HistoryTimecards, r.o.Build())
} else {
rel48, err := r.o.CreateMany(ctx, exec, r.number)
rel49, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryTimecards(ctx, exec, rel48...)
err = m.AttachHistoryTimecards(ctx, exec, rel49...)
if err != nil {
return err
}
@ -2148,12 +2186,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryTrapdata = append(m.R.HistoryTrapdata, r.o.Build())
} else {
rel49, err := r.o.CreateMany(ctx, exec, r.number)
rel50, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryTrapdata(ctx, exec, rel49...)
err = m.AttachHistoryTrapdata(ctx, exec, rel50...)
if err != nil {
return err
}
@ -2168,12 +2206,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryTraplocations = append(m.R.HistoryTraplocations, r.o.Build())
} else {
rel50, err := r.o.CreateMany(ctx, exec, r.number)
rel51, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryTraplocations(ctx, exec, rel50...)
err = m.AttachHistoryTraplocations(ctx, exec, rel51...)
if err != nil {
return err
}
@ -2188,12 +2226,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryTreatments = append(m.R.HistoryTreatments, r.o.Build())
} else {
rel51, err := r.o.CreateMany(ctx, exec, r.number)
rel52, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryTreatments(ctx, exec, rel51...)
err = m.AttachHistoryTreatments(ctx, exec, rel52...)
if err != nil {
return err
}
@ -2208,12 +2246,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryTreatmentareas = append(m.R.HistoryTreatmentareas, r.o.Build())
} else {
rel52, err := r.o.CreateMany(ctx, exec, r.number)
rel53, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryTreatmentareas(ctx, exec, rel52...)
err = m.AttachHistoryTreatmentareas(ctx, exec, rel53...)
if err != nil {
return err
}
@ -2228,12 +2266,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryZones = append(m.R.HistoryZones, r.o.Build())
} else {
rel53, err := r.o.CreateMany(ctx, exec, r.number)
rel54, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryZones(ctx, exec, rel53...)
err = m.AttachHistoryZones(ctx, exec, rel54...)
if err != nil {
return err
}
@ -2248,12 +2286,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.HistoryZones2s = append(m.R.HistoryZones2s, r.o.Build())
} else {
rel54, err := r.o.CreateMany(ctx, exec, r.number)
rel55, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachHistoryZones2s(ctx, exec, rel54...)
err = m.AttachHistoryZones2s(ctx, exec, rel55...)
if err != nil {
return err
}
@ -2268,12 +2306,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu
if r.o.alreadyPersisted {
m.R.User = append(m.R.User, r.o.Build())
} else {
rel55, err := r.o.CreateMany(ctx, exec, r.number)
rel56, err := r.o.CreateMany(ctx, exec, r.number)
if err != nil {
return err
}
err = m.AttachUser(ctx, exec, rel55...)
err = m.AttachUser(ctx, exec, rel56...)
if err != nil {
return err
}
@ -3977,6 +4015,54 @@ func (m organizationMods) WithoutFSZones2s() OrganizationMod {
})
}
func (m organizationMods) WithH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
o.r.H3Aggregations = []*organizationRH3AggregationsR{{
number: number,
o: related,
}}
})
}
func (m organizationMods) WithNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
related := o.f.NewH3AggregationWithContext(ctx, mods...)
m.WithH3Aggregations(number, related).Apply(ctx, o)
})
}
func (m organizationMods) AddH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{
number: number,
o: related,
})
})
}
func (m organizationMods) AddNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
related := o.f.NewH3AggregationWithContext(ctx, mods...)
m.AddH3Aggregations(number, related).Apply(ctx, o)
})
}
func (m organizationMods) AddExistingH3Aggregations(existingModels ...*models.H3Aggregation) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
for _, em := range existingModels {
o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{
o: o.f.FromExistingH3Aggregation(em),
})
}
})
}
func (m organizationMods) WithoutH3Aggregations() OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
o.r.H3Aggregations = nil
})
}
func (m organizationMods) WithHistoryContainerrelates(number int, related *HistoryContainerrelateTemplate) OrganizationMod {
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
o.r.HistoryContainerrelates = []*organizationRHistoryContainerrelatesR{{

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,616 @@
// 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/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)
})
}

View file

@ -0,0 +1,505 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package factory
import (
"context"
"testing"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
"github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull"
"github.com/jaswdr/faker/v2"
"github.com/stephenafamo/bob"
)
type SpatialRefSyMod interface {
Apply(context.Context, *SpatialRefSyTemplate)
}
type SpatialRefSyModFunc func(context.Context, *SpatialRefSyTemplate)
func (f SpatialRefSyModFunc) Apply(ctx context.Context, n *SpatialRefSyTemplate) {
f(ctx, n)
}
type SpatialRefSyModSlice []SpatialRefSyMod
func (mods SpatialRefSyModSlice) Apply(ctx context.Context, n *SpatialRefSyTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// SpatialRefSyTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type SpatialRefSyTemplate struct {
Srid func() int32
AuthName func() null.Val[string]
AuthSrid func() null.Val[int32]
Srtext func() null.Val[string]
Proj4text func() null.Val[string]
f *Factory
alreadyPersisted bool
}
// Apply mods to the SpatialRefSyTemplate
func (o *SpatialRefSyTemplate) Apply(ctx context.Context, mods ...SpatialRefSyMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.SpatialRefSy
// according to the relationships in the template. Nothing is inserted into the db
func (t SpatialRefSyTemplate) setModelRels(o *models.SpatialRefSy) {}
// BuildSetter returns an *models.SpatialRefSySetter
// this does nothing with the relationship templates
func (o SpatialRefSyTemplate) BuildSetter() *models.SpatialRefSySetter {
m := &models.SpatialRefSySetter{}
if o.Srid != nil {
val := o.Srid()
m.Srid = omit.From(val)
}
if o.AuthName != nil {
val := o.AuthName()
m.AuthName = omitnull.FromNull(val)
}
if o.AuthSrid != nil {
val := o.AuthSrid()
m.AuthSrid = omitnull.FromNull(val)
}
if o.Srtext != nil {
val := o.Srtext()
m.Srtext = omitnull.FromNull(val)
}
if o.Proj4text != nil {
val := o.Proj4text()
m.Proj4text = omitnull.FromNull(val)
}
return m
}
// BuildManySetter returns an []*models.SpatialRefSySetter
// this does nothing with the relationship templates
func (o SpatialRefSyTemplate) BuildManySetter(number int) []*models.SpatialRefSySetter {
m := make([]*models.SpatialRefSySetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.SpatialRefSy
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use SpatialRefSyTemplate.Create
func (o SpatialRefSyTemplate) Build() *models.SpatialRefSy {
m := &models.SpatialRefSy{}
if o.Srid != nil {
m.Srid = o.Srid()
}
if o.AuthName != nil {
m.AuthName = o.AuthName()
}
if o.AuthSrid != nil {
m.AuthSrid = o.AuthSrid()
}
if o.Srtext != nil {
m.Srtext = o.Srtext()
}
if o.Proj4text != nil {
m.Proj4text = o.Proj4text()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.SpatialRefSySlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use SpatialRefSyTemplate.CreateMany
func (o SpatialRefSyTemplate) BuildMany(number int) models.SpatialRefSySlice {
m := make(models.SpatialRefSySlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableSpatialRefSy(m *models.SpatialRefSySetter) {
if !(m.Srid.IsValue()) {
val := random_int32(nil)
m.Srid = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.SpatialRefSy
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *SpatialRefSyTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.SpatialRefSy) error {
var err error
return err
}
// Create builds a spatialRefSy and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *SpatialRefSyTemplate) Create(ctx context.Context, exec bob.Executor) (*models.SpatialRefSy, error) {
var err error
opt := o.BuildSetter()
ensureCreatableSpatialRefSy(opt)
m, err := models.SpatialRefSys.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 spatialRefSy and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *SpatialRefSyTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.SpatialRefSy {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a spatialRefSy 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 *SpatialRefSyTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.SpatialRefSy {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple spatialRefSys and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o SpatialRefSyTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.SpatialRefSySlice, error) {
var err error
m := make(models.SpatialRefSySlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple spatialRefSys and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o SpatialRefSyTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SpatialRefSySlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple spatialRefSys 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 SpatialRefSyTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SpatialRefSySlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// SpatialRefSy has methods that act as mods for the SpatialRefSyTemplate
var SpatialRefSyMods spatialRefSyMods
type spatialRefSyMods struct{}
func (m spatialRefSyMods) RandomizeAllColumns(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModSlice{
SpatialRefSyMods.RandomSrid(f),
SpatialRefSyMods.RandomAuthName(f),
SpatialRefSyMods.RandomAuthSrid(f),
SpatialRefSyMods.RandomSrtext(f),
SpatialRefSyMods.RandomProj4text(f),
}
}
// Set the model columns to this value
func (m spatialRefSyMods) Srid(val int32) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srid = func() int32 { return val }
})
}
// Set the Column from the function
func (m spatialRefSyMods) SridFunc(f func() int32) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srid = f
})
}
// Clear any values for the column
func (m spatialRefSyMods) UnsetSrid() SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srid = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m spatialRefSyMods) RandomSrid(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srid = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m spatialRefSyMods) AuthName(val null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthName = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m spatialRefSyMods) AuthNameFunc(f func() null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthName = f
})
}
// Clear any values for the column
func (m spatialRefSyMods) UnsetAuthName() SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthName = 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 spatialRefSyMods) RandomAuthName(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthName = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "256")
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 spatialRefSyMods) RandomAuthNameNotNull(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthName = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "256")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m spatialRefSyMods) AuthSrid(val null.Val[int32]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthSrid = func() null.Val[int32] { return val }
})
}
// Set the Column from the function
func (m spatialRefSyMods) AuthSridFunc(f func() null.Val[int32]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthSrid = f
})
}
// Clear any values for the column
func (m spatialRefSyMods) UnsetAuthSrid() SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthSrid = 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 spatialRefSyMods) RandomAuthSrid(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthSrid = 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 spatialRefSyMods) RandomAuthSridNotNull(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.AuthSrid = 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 spatialRefSyMods) Srtext(val null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srtext = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m spatialRefSyMods) SrtextFunc(f func() null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srtext = f
})
}
// Clear any values for the column
func (m spatialRefSyMods) UnsetSrtext() SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srtext = 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 spatialRefSyMods) RandomSrtext(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srtext = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "2048")
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 spatialRefSyMods) RandomSrtextNotNull(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Srtext = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "2048")
return null.From(val)
}
})
}
// Set the model columns to this value
func (m spatialRefSyMods) Proj4text(val null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Proj4text = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m spatialRefSyMods) Proj4textFunc(f func() null.Val[string]) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Proj4text = f
})
}
// Clear any values for the column
func (m spatialRefSyMods) UnsetProj4text() SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Proj4text = 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 spatialRefSyMods) RandomProj4text(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Proj4text = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "2048")
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 spatialRefSyMods) RandomProj4textNotNull(f *faker.Faker) SpatialRefSyMod {
return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) {
o.Proj4text = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f, "2048")
return null.From(val)
}
})
}
func (m spatialRefSyMods) WithParentsCascading() SpatialRefSyMod {
return SpatialRefSyModFunc(func(ctx context.Context, o *SpatialRefSyTemplate) {
if isDone, _ := spatialRefSyWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = spatialRefSyWithParentsCascadingCtx.WithValue(ctx, true)
})
}