Add precalc h3 cells to fieldseeker tables

This makes it so we don't have to try to parse the geometry JSON and
instead can just pass pre-calculated h3 values, which take fewer bytes,
everywhere.
This commit is contained in:
Eli Ribble 2026-01-05 23:25:16 +00:00
parent 2e74f95e8c
commit b542b8268e
21 changed files with 353 additions and 62 deletions

View file

@ -585,6 +585,7 @@ func (f *Factory) FromExistingFieldseekerPointlocation(m *models.FieldseekerPoin
o.Geospatial = func() null.Val[string] { return m.Geospatial }
o.Version = func() int32 { return m.Version }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.H3cell = func() null.Val[string] { return m.H3cell }
ctx := context.Background()
if m.R.Organization != nil {
@ -1238,6 +1239,7 @@ func (f *Factory) FromExistingFieldseekerServicerequest(m *models.FieldseekerSer
o.Geospatial = func() null.Val[string] { return m.Geospatial }
o.Version = func() int32 { return m.Version }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.H3cell = func() null.Val[string] { return m.H3cell }
ctx := context.Background()
if m.R.Organization != nil {
@ -1484,6 +1486,7 @@ func (f *Factory) FromExistingFieldseekerTrapdatum(m *models.FieldseekerTrapdatu
o.Geospatial = func() null.Val[string] { return m.Geospatial }
o.Version = func() int32 { return m.Version }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.H3cell = func() null.Val[string] { return m.H3cell }
ctx := context.Background()
if m.R.Organization != nil {
@ -1632,6 +1635,7 @@ func (f *Factory) FromExistingFieldseekerTreatment(m *models.FieldseekerTreatmen
o.Geospatial = func() null.Val[string] { return m.Geospatial }
o.Version = func() int32 { return m.Version }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.H3cell = func() null.Val[string] { return m.H3cell }
ctx := context.Background()
if m.R.Organization != nil {

View file

@ -88,6 +88,7 @@ type FieldseekerPointlocationTemplate struct {
Geospatial func() null.Val[string]
Version func() int32
OrganizationID func() int32
H3cell func() null.Val[string]
r fieldseekerPointlocationR
f *Factory
@ -484,6 +485,9 @@ func (o FieldseekerPointlocationTemplate) Build() *models.FieldseekerPointlocati
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
if o.H3cell != nil {
m.H3cell = o.H3cell()
}
o.setModelRels(m)
@ -683,6 +687,7 @@ func (m fieldseekerPointlocationMods) RandomizeAllColumns(f *faker.Faker) Fields
FieldseekerPointlocationMods.RandomGeospatial(f),
FieldseekerPointlocationMods.RandomVersion(f),
FieldseekerPointlocationMods.RandomOrganizationID(f),
FieldseekerPointlocationMods.RandomH3cell(f),
}
}
@ -3120,6 +3125,59 @@ func (m fieldseekerPointlocationMods) RandomOrganizationID(f *faker.Faker) Field
})
}
// Set the model columns to this value
func (m fieldseekerPointlocationMods) H3cell(val null.Val[string]) FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) {
o.H3cell = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerPointlocationMods) H3cellFunc(f func() null.Val[string]) FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) {
o.H3cell = f
})
}
// Clear any values for the column
func (m fieldseekerPointlocationMods) UnsetH3cell() FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) {
o.H3cell = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPointlocationMods) RandomH3cell(f *faker.Faker) FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPointlocationMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
func (m fieldseekerPointlocationMods) WithParentsCascading() FieldseekerPointlocationMod {
return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) {
if isDone, _ := fieldseekerPointlocationWithParentsCascadingCtx.Value(ctx); isDone {

View file

@ -130,6 +130,7 @@ type FieldseekerServicerequestTemplate struct {
Geospatial func() null.Val[string]
Version func() int32
OrganizationID func() int32
H3cell func() null.Val[string]
r fieldseekerServicerequestR
f *Factory
@ -820,6 +821,9 @@ func (o FieldseekerServicerequestTemplate) Build() *models.FieldseekerServicereq
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
if o.H3cell != nil {
m.H3cell = o.H3cell()
}
o.setModelRels(m)
@ -1061,6 +1065,7 @@ func (m fieldseekerServicerequestMods) RandomizeAllColumns(f *faker.Faker) Field
FieldseekerServicerequestMods.RandomGeospatial(f),
FieldseekerServicerequestMods.RandomVersion(f),
FieldseekerServicerequestMods.RandomOrganizationID(f),
FieldseekerServicerequestMods.RandomH3cell(f),
}
}
@ -5724,6 +5729,59 @@ func (m fieldseekerServicerequestMods) RandomOrganizationID(f *faker.Faker) Fiel
})
}
// Set the model columns to this value
func (m fieldseekerServicerequestMods) H3cell(val null.Val[string]) FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) {
o.H3cell = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerServicerequestMods) H3cellFunc(f func() null.Val[string]) FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) {
o.H3cell = f
})
}
// Clear any values for the column
func (m fieldseekerServicerequestMods) UnsetH3cell() FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) {
o.H3cell = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerServicerequestMods) RandomH3cell(f *faker.Faker) FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerServicerequestMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
func (m fieldseekerServicerequestMods) WithParentsCascading() FieldseekerServicerequestMod {
return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) {
if isDone, _ := fieldseekerServicerequestWithParentsCascadingCtx.Value(ctx); isDone {

View file

@ -86,6 +86,7 @@ type FieldseekerTrapdatumTemplate struct {
Geospatial func() null.Val[string]
Version func() int32
OrganizationID func() int32
H3cell func() null.Val[string]
r fieldseekerTrapdatumR
f *Factory
@ -468,6 +469,9 @@ func (o FieldseekerTrapdatumTemplate) Build() *models.FieldseekerTrapdatum {
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
if o.H3cell != nil {
m.H3cell = o.H3cell()
}
o.setModelRels(m)
@ -665,6 +669,7 @@ func (m fieldseekerTrapdatumMods) RandomizeAllColumns(f *faker.Faker) Fieldseeke
FieldseekerTrapdatumMods.RandomGeospatial(f),
FieldseekerTrapdatumMods.RandomVersion(f),
FieldseekerTrapdatumMods.RandomOrganizationID(f),
FieldseekerTrapdatumMods.RandomH3cell(f),
}
}
@ -2996,6 +3001,59 @@ func (m fieldseekerTrapdatumMods) RandomOrganizationID(f *faker.Faker) Fieldseek
})
}
// Set the model columns to this value
func (m fieldseekerTrapdatumMods) H3cell(val null.Val[string]) FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
o.H3cell = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerTrapdatumMods) H3cellFunc(f func() null.Val[string]) FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
o.H3cell = f
})
}
// Clear any values for the column
func (m fieldseekerTrapdatumMods) UnsetH3cell() FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
o.H3cell = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerTrapdatumMods) RandomH3cell(f *faker.Faker) FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerTrapdatumMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
func (m fieldseekerTrapdatumMods) WithParentsCascading() FieldseekerTrapdatumMod {
return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) {
if isDone, _ := fieldseekerTrapdatumWithParentsCascadingCtx.Value(ctx); isDone {

View file

@ -98,6 +98,7 @@ type FieldseekerTreatmentTemplate struct {
Geospatial func() null.Val[string]
Version func() int32
OrganizationID func() int32
H3cell func() null.Val[string]
r fieldseekerTreatmentR
f *Factory
@ -564,6 +565,9 @@ func (o FieldseekerTreatmentTemplate) Build() *models.FieldseekerTreatment {
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
if o.H3cell != nil {
m.H3cell = o.H3cell()
}
o.setModelRels(m)
@ -773,6 +777,7 @@ func (m fieldseekerTreatmentMods) RandomizeAllColumns(f *faker.Faker) Fieldseeke
FieldseekerTreatmentMods.RandomGeospatial(f),
FieldseekerTreatmentMods.RandomVersion(f),
FieldseekerTreatmentMods.RandomOrganizationID(f),
FieldseekerTreatmentMods.RandomH3cell(f),
}
}
@ -3740,6 +3745,59 @@ func (m fieldseekerTreatmentMods) RandomOrganizationID(f *faker.Faker) Fieldseek
})
}
// Set the model columns to this value
func (m fieldseekerTreatmentMods) H3cell(val null.Val[string]) FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) {
o.H3cell = func() null.Val[string] { return val }
})
}
// Set the Column from the function
func (m fieldseekerTreatmentMods) H3cellFunc(f func() null.Val[string]) FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) {
o.H3cell = f
})
}
// Clear any values for the column
func (m fieldseekerTreatmentMods) UnsetH3cell() FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) {
o.H3cell = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerTreatmentMods) RandomH3cell(f *faker.Faker) FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerTreatmentMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) {
o.H3cell = func() null.Val[string] {
if f == nil {
f = &defaultFaker
}
val := random_string(f)
return null.From(val)
}
})
}
func (m fieldseekerTreatmentMods) WithParentsCascading() FieldseekerTreatmentMod {
return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) {
if isDone, _ := fieldseekerTreatmentWithParentsCascadingCtx.Value(ctx); isDone {