Remove old FieldSeeker tables, use v2 generated tables.
This requires a bunch of changes since the types on these tables are much closer to the underlying types of the Fieldseeker data we are getting back from the API. I now need to use proper UUID types everywhere, which means I had to modify the bob gen config to consistently use google UUID, my UUID library of choice. I also had to add the organization_id to all the fieldseeker tables since we rely on them existing for some of our compound queries. There were some changes to the API type signatures to get things to build. I may yet regret those.
This commit is contained in:
parent
58f5afccc9
commit
1395e3d3ac
445 changed files with 54077 additions and 275856 deletions
|
|
@ -1,21 +1,22 @@
|
|||
// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT.
|
||||
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package factory
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
"github.com/gofrs/uuid/v5"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jaswdr/faker/v2"
|
||||
"github.com/stephenafamo/bob"
|
||||
"github.com/stephenafamo/bob/types"
|
||||
)
|
||||
|
||||
type FieldseekerTrapdatumMod interface {
|
||||
|
|
@ -40,21 +41,21 @@ func (mods FieldseekerTrapdatumModSlice) Apply(ctx context.Context, n *Fieldseek
|
|||
// all columns are optional and should be set by mods
|
||||
type FieldseekerTrapdatumTemplate struct {
|
||||
Objectid func() int64
|
||||
Traptype func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum]
|
||||
Trapactivitytype func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum]
|
||||
Traptype func() null.Val[string]
|
||||
Trapactivitytype func() null.Val[string]
|
||||
Startdatetime func() null.Val[time.Time]
|
||||
Enddatetime func() null.Val[time.Time]
|
||||
Comments func() null.Val[string]
|
||||
Idbytech func() null.Val[string]
|
||||
Sortbytech func() null.Val[string]
|
||||
Processed func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]
|
||||
Sitecond func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum]
|
||||
Processed func() null.Val[int16]
|
||||
Sitecond func() null.Val[string]
|
||||
Locationname func() null.Val[string]
|
||||
Recordstatus func() null.Val[int16]
|
||||
Reviewed func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]
|
||||
Reviewed func() null.Val[int16]
|
||||
Reviewedby func() null.Val[string]
|
||||
Revieweddate func() null.Val[time.Time]
|
||||
Trapcondition func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum]
|
||||
Trapcondition func() null.Val[string]
|
||||
Trapnights func() null.Val[int16]
|
||||
Zone func() null.Val[string]
|
||||
Zone2 func() null.Val[string]
|
||||
|
|
@ -68,7 +69,7 @@ type FieldseekerTrapdatumTemplate struct {
|
|||
Gatewaysync func() null.Val[int16]
|
||||
LocID func() null.Val[uuid.UUID]
|
||||
Voltage func() null.Val[float64]
|
||||
Winddir func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166]
|
||||
Winddir func() null.Val[string]
|
||||
Windspeed func() null.Val[float64]
|
||||
Avetemp func() null.Val[float64]
|
||||
Raingauge func() null.Val[float64]
|
||||
|
|
@ -80,14 +81,26 @@ type FieldseekerTrapdatumTemplate struct {
|
|||
Creator func() null.Val[string]
|
||||
Editdate func() null.Val[time.Time]
|
||||
Editor func() null.Val[string]
|
||||
Lure func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu]
|
||||
Lure func() null.Val[string]
|
||||
Geometry func() types.JSON[json.RawMessage]
|
||||
Geospatial func() null.Val[string]
|
||||
Version func() int32
|
||||
OrganizationID func() int32
|
||||
|
||||
r fieldseekerTrapdatumR
|
||||
f *Factory
|
||||
|
||||
alreadyPersisted bool
|
||||
}
|
||||
|
||||
type fieldseekerTrapdatumR struct {
|
||||
Organization *fieldseekerTrapdatumROrganizationR
|
||||
}
|
||||
|
||||
type fieldseekerTrapdatumROrganizationR struct {
|
||||
o *OrganizationTemplate
|
||||
}
|
||||
|
||||
// Apply mods to the FieldseekerTrapdatumTemplate
|
||||
func (o *FieldseekerTrapdatumTemplate) Apply(ctx context.Context, mods ...FieldseekerTrapdatumMod) {
|
||||
for _, mod := range mods {
|
||||
|
|
@ -97,7 +110,14 @@ func (o *FieldseekerTrapdatumTemplate) Apply(ctx context.Context, mods ...Fields
|
|||
|
||||
// setModelRels creates and sets the relationships on *models.FieldseekerTrapdatum
|
||||
// according to the relationships in the template. Nothing is inserted into the db
|
||||
func (t FieldseekerTrapdatumTemplate) setModelRels(o *models.FieldseekerTrapdatum) {}
|
||||
func (t FieldseekerTrapdatumTemplate) setModelRels(o *models.FieldseekerTrapdatum) {
|
||||
if t.r.Organization != nil {
|
||||
rel := t.r.Organization.o.Build()
|
||||
rel.R.Trapdata = append(rel.R.Trapdata, o)
|
||||
o.OrganizationID = rel.ID // h2
|
||||
o.R.Organization = rel
|
||||
}
|
||||
}
|
||||
|
||||
// BuildSetter returns an *models.FieldseekerTrapdatumSetter
|
||||
// this does nothing with the relationship templates
|
||||
|
|
@ -272,10 +292,22 @@ func (o FieldseekerTrapdatumTemplate) BuildSetter() *models.FieldseekerTrapdatum
|
|||
val := o.Lure()
|
||||
m.Lure = omitnull.FromNull(val)
|
||||
}
|
||||
if o.Geometry != nil {
|
||||
val := o.Geometry()
|
||||
m.Geometry = omit.From(val)
|
||||
}
|
||||
if o.Geospatial != nil {
|
||||
val := o.Geospatial()
|
||||
m.Geospatial = omitnull.FromNull(val)
|
||||
}
|
||||
if o.Version != nil {
|
||||
val := o.Version()
|
||||
m.Version = omit.From(val)
|
||||
}
|
||||
if o.OrganizationID != nil {
|
||||
val := o.OrganizationID()
|
||||
m.OrganizationID = omit.From(val)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
@ -424,9 +456,18 @@ func (o FieldseekerTrapdatumTemplate) Build() *models.FieldseekerTrapdatum {
|
|||
if o.Lure != nil {
|
||||
m.Lure = o.Lure()
|
||||
}
|
||||
if o.Geometry != nil {
|
||||
m.Geometry = o.Geometry()
|
||||
}
|
||||
if o.Geospatial != nil {
|
||||
m.Geospatial = o.Geospatial()
|
||||
}
|
||||
if o.Version != nil {
|
||||
m.Version = o.Version()
|
||||
}
|
||||
if o.OrganizationID != nil {
|
||||
m.OrganizationID = o.OrganizationID()
|
||||
}
|
||||
|
||||
o.setModelRels(m)
|
||||
|
||||
|
|
@ -447,6 +488,14 @@ func (o FieldseekerTrapdatumTemplate) BuildMany(number int) models.FieldseekerTr
|
|||
}
|
||||
|
||||
func ensureCreatableFieldseekerTrapdatum(m *models.FieldseekerTrapdatumSetter) {
|
||||
if !(m.Geometry.IsValue()) {
|
||||
val := random_types_JSON_json_RawMessage_(nil)
|
||||
m.Geometry = 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.FieldseekerTrapdatum
|
||||
|
|
@ -465,11 +514,30 @@ func (o *FieldseekerTrapdatumTemplate) Create(ctx context.Context, exec bob.Exec
|
|||
opt := o.BuildSetter()
|
||||
ensureCreatableFieldseekerTrapdatum(opt)
|
||||
|
||||
if o.r.Organization == nil {
|
||||
FieldseekerTrapdatumMods.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.FieldseekerTrapdata.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
|
||||
}
|
||||
|
|
@ -589,7 +657,10 @@ func (m fieldseekerTrapdatumMods) RandomizeAllColumns(f *faker.Faker) Fieldseeke
|
|||
FieldseekerTrapdatumMods.RandomEditdate(f),
|
||||
FieldseekerTrapdatumMods.RandomEditor(f),
|
||||
FieldseekerTrapdatumMods.RandomLure(f),
|
||||
FieldseekerTrapdatumMods.RandomGeometry(f),
|
||||
FieldseekerTrapdatumMods.RandomGeospatial(f),
|
||||
FieldseekerTrapdatumMods.RandomVersion(f),
|
||||
FieldseekerTrapdatumMods.RandomOrganizationID(f),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -625,14 +696,14 @@ func (m fieldseekerTrapdatumMods) RandomObjectid(f *faker.Faker) FieldseekerTrap
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Traptype(val null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Traptype(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] { return val }
|
||||
o.Traptype = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) TraptypeFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) TraptypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Traptype = f
|
||||
})
|
||||
|
|
@ -650,12 +721,12 @@ func (m fieldseekerTrapdatumMods) UnsetTraptype() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomTraptype(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] {
|
||||
o.Traptype = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitotraptypeEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -666,26 +737,26 @@ func (m fieldseekerTrapdatumMods) RandomTraptype(f *faker.Faker) FieldseekerTrap
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomTraptypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] {
|
||||
o.Traptype = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitotraptypeEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Trapactivitytype(val null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Trapactivitytype(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] { return val }
|
||||
o.Trapactivitytype = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapactivitytype = f
|
||||
})
|
||||
|
|
@ -703,12 +774,12 @@ func (m fieldseekerTrapdatumMods) UnsetTrapactivitytype() FieldseekerTrapdatumMo
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] {
|
||||
o.Trapactivitytype = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitrapactivitytypeEnum(f)
|
||||
val := random_string(f, "1")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -719,12 +790,12 @@ func (m fieldseekerTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) Fieldse
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomTrapactivitytypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] {
|
||||
o.Trapactivitytype = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitrapactivitytypeEnum(f)
|
||||
val := random_string(f, "1")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -996,14 +1067,14 @@ func (m fieldseekerTrapdatumMods) RandomSortbytechNotNull(f *faker.Faker) Fields
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Processed(val null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Processed(val null.Val[int16]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { return val }
|
||||
o.Processed = func() null.Val[int16] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) ProcessedFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Processed = f
|
||||
})
|
||||
|
|
@ -1021,12 +1092,12 @@ func (m fieldseekerTrapdatumMods) UnsetProcessed() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomProcessed(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] {
|
||||
o.Processed = func() null.Val[int16] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitFEnum(f)
|
||||
val := random_int16(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1037,26 +1108,26 @@ func (m fieldseekerTrapdatumMods) RandomProcessed(f *faker.Faker) FieldseekerTra
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] {
|
||||
o.Processed = func() null.Val[int16] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitFEnum(f)
|
||||
val := random_int16(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Sitecond(val null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Sitecond(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] { return val }
|
||||
o.Sitecond = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) SitecondFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) SitecondFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Sitecond = f
|
||||
})
|
||||
|
|
@ -1074,12 +1145,12 @@ func (m fieldseekerTrapdatumMods) UnsetSitecond() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomSitecond(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] {
|
||||
o.Sitecond = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitositeconditionEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1090,12 +1161,12 @@ func (m fieldseekerTrapdatumMods) RandomSitecond(f *faker.Faker) FieldseekerTrap
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomSitecondNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] {
|
||||
o.Sitecond = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitositeconditionEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1208,14 +1279,14 @@ func (m fieldseekerTrapdatumMods) RandomRecordstatusNotNull(f *faker.Faker) Fiel
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Reviewed(val null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Reviewed(val null.Val[int16]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { return val }
|
||||
o.Reviewed = func() null.Val[int16] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) ReviewedFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Reviewed = f
|
||||
})
|
||||
|
|
@ -1233,12 +1304,12 @@ func (m fieldseekerTrapdatumMods) UnsetReviewed() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomReviewed(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] {
|
||||
o.Reviewed = func() null.Val[int16] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitFEnum(f)
|
||||
val := random_int16(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1249,12 +1320,12 @@ func (m fieldseekerTrapdatumMods) RandomReviewed(f *faker.Faker) FieldseekerTrap
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] {
|
||||
o.Reviewed = func() null.Val[int16] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataNotinuitFEnum(f)
|
||||
val := random_int16(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1367,14 +1438,14 @@ func (m fieldseekerTrapdatumMods) RandomRevieweddateNotNull(f *faker.Faker) Fiel
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Trapcondition(val null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Trapcondition(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] { return val }
|
||||
o.Trapcondition = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) TrapconditionFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapcondition = f
|
||||
})
|
||||
|
|
@ -1392,12 +1463,12 @@ func (m fieldseekerTrapdatumMods) UnsetTrapcondition() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomTrapcondition(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] {
|
||||
o.Trapcondition = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitotrapconditionEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -1408,12 +1479,12 @@ func (m fieldseekerTrapdatumMods) RandomTrapcondition(f *faker.Faker) Fieldseeke
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomTrapconditionNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] {
|
||||
o.Trapcondition = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataMosquitotrapconditionEnum(f)
|
||||
val := random_string(f, "25")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -2109,14 +2180,14 @@ func (m fieldseekerTrapdatumMods) RandomVoltageNotNull(f *faker.Faker) Fieldseek
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Winddir(val null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Winddir(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] { return val }
|
||||
o.Winddir = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) WinddirFunc(f func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) WinddirFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Winddir = f
|
||||
})
|
||||
|
|
@ -2134,12 +2205,12 @@ func (m fieldseekerTrapdatumMods) UnsetWinddir() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomWinddir(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] {
|
||||
o.Winddir = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166(f)
|
||||
val := random_string(f, "3")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -2150,12 +2221,12 @@ func (m fieldseekerTrapdatumMods) RandomWinddir(f *faker.Faker) FieldseekerTrapd
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomWinddirNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] {
|
||||
o.Winddir = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166(f)
|
||||
val := random_string(f, "3")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -2745,14 +2816,14 @@ func (m fieldseekerTrapdatumMods) RandomEditorNotNull(f *faker.Faker) Fieldseeke
|
|||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Lure(val null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) Lure(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] { return val }
|
||||
o.Lure = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) LureFunc(f func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu]) FieldseekerTrapdatumMod {
|
||||
func (m fieldseekerTrapdatumMods) LureFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Lure = f
|
||||
})
|
||||
|
|
@ -2770,12 +2841,12 @@ func (m fieldseekerTrapdatumMods) UnsetLure() FieldseekerTrapdatumMod {
|
|||
// The generated value is sometimes null
|
||||
func (m fieldseekerTrapdatumMods) RandomLure(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] {
|
||||
o.Lure = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu(f)
|
||||
val := random_string(f, "256")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -2786,12 +2857,96 @@ func (m fieldseekerTrapdatumMods) RandomLure(f *faker.Faker) FieldseekerTrapdatu
|
|||
// The generated value is never null
|
||||
func (m fieldseekerTrapdatumMods) RandomLureNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] {
|
||||
o.Lure = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_enums_FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu(f)
|
||||
val := random_string(f, "256")
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geometry = func() types.JSON[json.RawMessage] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geometry = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m fieldseekerTrapdatumMods) UnsetGeometry() FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geometry = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m fieldseekerTrapdatumMods) RandomGeometry(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geometry = func() types.JSON[json.RawMessage] {
|
||||
return random_types_JSON_json_RawMessage_(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) Geospatial(val null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geospatial = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geospatial = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m fieldseekerTrapdatumMods) UnsetGeospatial() FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geospatial = 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 fieldseekerTrapdatumMods) RandomGeospatial(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geospatial = 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 fieldseekerTrapdatumMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.Geospatial = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_string(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
|
|
@ -2828,11 +2983,77 @@ func (m fieldseekerTrapdatumMods) RandomVersion(f *faker.Faker) FieldseekerTrapd
|
|||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m fieldseekerTrapdatumMods) OrganizationID(val int32) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.OrganizationID = func() int32 { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m fieldseekerTrapdatumMods) OrganizationIDFunc(f func() int32) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.OrganizationID = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m fieldseekerTrapdatumMods) UnsetOrganizationID() FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
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 fieldseekerTrapdatumMods) RandomOrganizationID(f *faker.Faker) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.OrganizationID = func() int32 {
|
||||
return random_int32(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m fieldseekerTrapdatumMods) WithParentsCascading() FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
if isDone, _ := fieldseekerTrapdatumWithParentsCascadingCtx.Value(ctx); isDone {
|
||||
return
|
||||
}
|
||||
ctx = fieldseekerTrapdatumWithParentsCascadingCtx.WithValue(ctx, true)
|
||||
{
|
||||
|
||||
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
|
||||
m.WithOrganization(related).Apply(ctx, o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m fieldseekerTrapdatumMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.r.Organization = &fieldseekerTrapdatumROrganizationR{
|
||||
o: rel,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m fieldseekerTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
related := o.f.NewOrganizationWithContext(ctx, mods...)
|
||||
|
||||
m.WithOrganization(related).Apply(ctx, o)
|
||||
})
|
||||
}
|
||||
|
||||
func (m fieldseekerTrapdatumMods) WithExistingOrganization(em *models.Organization) FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.r.Organization = &fieldseekerTrapdatumROrganizationR{
|
||||
o: o.f.FromExistingOrganization(em),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m fieldseekerTrapdatumMods) WithoutOrganization() FieldseekerTrapdatumMod {
|
||||
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
|
||||
o.r.Organization = nil
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue