From e48abb09c0f478de58c418ab450f4ce2978b9832 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 13 Nov 2025 23:48:41 +0000 Subject: [PATCH] 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. --- database.go | 58 ++ dberrors/h3_aggregation.bob.go | 26 + dberrors/h3_aggregation.bob_test.go | 110 +++ dberrors/spatial_ref_sys.bob.go | 17 + dbinfo/fs_containerrelate.bob.go | 4 +- dbinfo/fs_fieldscoutinglog.bob.go | 4 +- dbinfo/fs_habitatrelate.bob.go | 4 +- dbinfo/fs_inspectionsample.bob.go | 4 +- dbinfo/fs_inspectionsampledetail.bob.go | 4 +- dbinfo/fs_linelocation.bob.go | 4 +- dbinfo/fs_locationtracking.bob.go | 4 +- dbinfo/fs_mosquitoinspection.bob.go | 4 +- dbinfo/fs_pointlocation.bob.go | 12 +- dbinfo/fs_polygonlocation.bob.go | 4 +- dbinfo/fs_pool.bob.go | 4 +- dbinfo/fs_pooldetail.bob.go | 4 +- dbinfo/fs_proposedtreatmentarea.bob.go | 4 +- dbinfo/fs_qamosquitoinspection.bob.go | 4 +- dbinfo/fs_rodentlocation.bob.go | 4 +- dbinfo/fs_samplecollection.bob.go | 4 +- dbinfo/fs_samplelocation.bob.go | 4 +- dbinfo/fs_servicerequest.bob.go | 12 +- dbinfo/fs_speciesabundance.bob.go | 4 +- dbinfo/fs_stormdrain.bob.go | 4 +- dbinfo/fs_timecard.bob.go | 4 +- dbinfo/fs_trapdata.bob.go | 4 +- dbinfo/fs_traplocation.bob.go | 4 +- dbinfo/fs_treatment.bob.go | 4 +- dbinfo/fs_treatmentarea.bob.go | 4 +- dbinfo/fs_zones.bob.go | 4 +- dbinfo/fs_zones2.bob.go | 4 +- dbinfo/geography_columns.bob.go | 122 +++ dbinfo/geometry_columns.bob.go | 122 +++ dbinfo/h3_aggregation.bob.go | 196 ++++ dbinfo/raster_columns.bob.go | 222 +++++ dbinfo/raster_overviews.bob.go | 142 +++ dbinfo/spatial_ref_sys.bob.go | 146 +++ enums/enums.bob.go | 73 ++ factory/bobfactory_context.bob.go | 20 + factory/bobfactory_main.bob.go | 314 +++++- factory/bobfactory_main.bob_test.go | 48 + factory/bobfactory_random.bob.go | 47 + factory/bobfactory_random.bob_test.go | 23 + factory/fs_containerrelate.bob.go | 40 +- factory/fs_fieldscoutinglog.bob.go | 40 +- factory/fs_habitatrelate.bob.go | 40 +- factory/fs_inspectionsample.bob.go | 40 +- factory/fs_inspectionsampledetail.bob.go | 40 +- factory/fs_linelocation.bob.go | 40 +- factory/fs_locationtracking.bob.go | 40 +- factory/fs_mosquitoinspection.bob.go | 40 +- factory/fs_pointlocation.bob.go | 120 +-- factory/fs_polygonlocation.bob.go | 40 +- factory/fs_pool.bob.go | 40 +- factory/fs_pooldetail.bob.go | 40 +- factory/fs_proposedtreatmentarea.bob.go | 40 +- factory/fs_qamosquitoinspection.bob.go | 40 +- factory/fs_rodentlocation.bob.go | 40 +- factory/fs_samplecollection.bob.go | 40 +- factory/fs_samplelocation.bob.go | 40 +- factory/fs_servicerequest.bob.go | 120 +-- factory/fs_speciesabundance.bob.go | 40 +- factory/fs_stormdrain.bob.go | 40 +- factory/fs_timecard.bob.go | 40 +- factory/fs_trapdata.bob.go | 40 +- factory/fs_traplocation.bob.go | 40 +- factory/fs_treatment.bob.go | 40 +- factory/fs_treatmentarea.bob.go | 40 +- factory/fs_zones.bob.go | 40 +- factory/fs_zones2.bob.go | 40 +- factory/geography_columns.bob.go | 500 ++++++++++ factory/geometry_columns.bob.go | 500 ++++++++++ factory/h3_aggregation.bob.go | 542 +++++++++++ factory/organization.bob.go | 198 ++-- factory/raster_columns.bob.go | 1081 +++++++++++++++++++++ factory/raster_overviews.bob.go | 616 ++++++++++++ factory/spatial_ref_sys.bob.go | 505 ++++++++++ go.mod | 3 +- go.sum | 2 + h3.go | 43 +- migrations/00013_fs_globalid_not_null.sql | 73 ++ migrations/00014_h3_aggregation.sql | 20 + models/bob_joins.bob.go | 2 + models/bob_loaders.bob.go | 4 + models/bob_types.bob_test.go | 43 + models/bob_where.bob.go | 18 + models/fs_containerrelate.bob.go | 20 +- models/fs_fieldscoutinglog.bob.go | 20 +- models/fs_habitatrelate.bob.go | 20 +- models/fs_inspectionsample.bob.go | 20 +- models/fs_inspectionsampledetail.bob.go | 20 +- models/fs_linelocation.bob.go | 20 +- models/fs_locationtracking.bob.go | 20 +- models/fs_mosquitoinspection.bob.go | 20 +- models/fs_pointlocation.bob.go | 60 +- models/fs_polygonlocation.bob.go | 20 +- models/fs_pool.bob.go | 20 +- models/fs_pooldetail.bob.go | 20 +- models/fs_proposedtreatmentarea.bob.go | 20 +- models/fs_qamosquitoinspection.bob.go | 20 +- models/fs_rodentlocation.bob.go | 20 +- models/fs_samplecollection.bob.go | 20 +- models/fs_samplelocation.bob.go | 20 +- models/fs_servicerequest.bob.go | 408 ++++---- models/fs_speciesabundance.bob.go | 20 +- models/fs_stormdrain.bob.go | 20 +- models/fs_timecard.bob.go | 20 +- models/fs_trapdata.bob.go | 20 +- models/fs_traplocation.bob.go | 20 +- models/fs_treatment.bob.go | 20 +- models/fs_treatmentarea.bob.go | 20 +- models/fs_zones.bob.go | 20 +- models/fs_zones2.bob.go | 20 +- models/geography_columns.bob.go | 120 +++ models/geometry_columns.bob.go | 120 +++ models/h3_aggregation.bob.go | 703 ++++++++++++++ models/organization.bob.go | 193 ++++ models/raster_columns.bob.go | 171 ++++ models/raster_overviews.bob.go | 130 +++ models/spatial_ref_sys.bob.go | 450 +++++++++ 120 files changed, 8516 insertions(+), 1539 deletions(-) create mode 100644 dberrors/h3_aggregation.bob.go create mode 100644 dberrors/h3_aggregation.bob_test.go create mode 100644 dberrors/spatial_ref_sys.bob.go create mode 100644 dbinfo/geography_columns.bob.go create mode 100644 dbinfo/geometry_columns.bob.go create mode 100644 dbinfo/h3_aggregation.bob.go create mode 100644 dbinfo/raster_columns.bob.go create mode 100644 dbinfo/raster_overviews.bob.go create mode 100644 dbinfo/spatial_ref_sys.bob.go create mode 100644 factory/geography_columns.bob.go create mode 100644 factory/geometry_columns.bob.go create mode 100644 factory/h3_aggregation.bob.go create mode 100644 factory/raster_columns.bob.go create mode 100644 factory/raster_overviews.bob.go create mode 100644 factory/spatial_ref_sys.bob.go create mode 100644 migrations/00013_fs_globalid_not_null.sql create mode 100644 migrations/00014_h3_aggregation.sql create mode 100644 models/geography_columns.bob.go create mode 100644 models/geometry_columns.bob.go create mode 100644 models/h3_aggregation.bob.go create mode 100644 models/raster_columns.bob.go create mode 100644 models/raster_overviews.bob.go create mode 100644 models/spatial_ref_sys.bob.go diff --git a/database.go b/database.go index 3641aaf0..88e98448 100644 --- a/database.go +++ b/database.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "context" "database/sql" "embed" @@ -11,12 +12,18 @@ import ( //"github.com/georgysavva/scany/v2/pgxscan" //"github.com/jackc/pgx/v5" + "github.com/Gleipnir-Technology/nidus-sync/enums" + "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/stdlib" _ "github.com/jackc/pgx/v5/stdlib" "github.com/pressly/goose/v3" "github.com/rs/zerolog/log" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/dialect/psql/dialect" + "github.com/stephenafamo/bob/dialect/psql/im" + "github.com/uber/h3-go/v4" ) //go:embed migrations/*.sql @@ -143,3 +150,54 @@ func needsMigrations(connection_string string) (*bool, error) { } return &hasPending, nil } + +func updateSummaryTables(ctx context.Context, org *models.Organization) { + /*org, err := models.FindOrganization(ctx, PGInstance.BobDB, org_id) + if err != nil { + log.Error().Err(err).Msg("Failed to get organization") + }*/ + log.Info().Int("org_id", int(org.ID)).Msg("Getting point locations") + point_locations, err := org.FSPointlocations().All(ctx, PGInstance.BobDB) + if err != nil { + log.Error().Err(err).Msg("Failed to get organization") + return + } + log.Info().Int("count", len(point_locations)).Msg("Summarizing point locations") + + for i := range 16 { + log.Info().Int("resolution", i).Msg("Working summary layer") + cellToCount := make(map[h3.Cell]int, 0) + for _, p := range point_locations { + cell, err := getCell(p.GeometryX, p.GeometryY, i) + if err != nil { + log.Error().Err(err).Msg("Failed to get cell") + continue + } + //log.Info().Float64("X", p.GeometryX).Float64("Y", p.GeometryY).Str("cell", cell.String()).Msg("Converted lat/lng") + cellToCount[cell] = cellToCount[cell] + 1 + } + var to_insert []bob.Mod[*dialect.InsertQuery] = make([]bob.Mod[*dialect.InsertQuery], 0) + to_insert = append(to_insert, im.Into("h3_aggregation", "cell", "resolution", "count_", "type_", "organization_id")) + for cell, count := range cellToCount { + to_insert = append(to_insert, im.Values(psql.Arg(cell.String(), i, count, enums.H3aggregationtypeServicerequest, org.ID))) + } + //to_insert = append(to_insert, im.OnConflict("h3_aggregation_cell_organization_id_type__key").DoUpdate( + to_insert = append(to_insert, im.OnConflict("cell, organization_id, type_").DoUpdate( + im.SetCol("count_").To(psql.Raw("EXCLUDED.count_")), + )) + //log.Info().Str("sql", insertQueryToString(psql.Insert(to_insert...))).Msg("Updating...") + _, err := psql.Insert(to_insert...).Exec(ctx, PGInstance.BobDB) + if err != nil { + log.Error().Err(err).Msg("Faild to add h3 aggregation") + } + } +} + +func insertQueryToString(query bob.BaseQuery[*dialect.InsertQuery]) string { + buf := new(bytes.Buffer) + _, err := query.WriteQuery(context.TODO(), buf, 0) + if err != nil { + return fmt.Sprintf("Failed to write query: %v", err) + } + return buf.String() +} diff --git a/dberrors/h3_aggregation.bob.go b/dberrors/h3_aggregation.bob.go new file mode 100644 index 00000000..11582aa2 --- /dev/null +++ b/dberrors/h3_aggregation.bob.go @@ -0,0 +1,26 @@ +// 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 dberrors + +var H3AggregationErrors = &h3AggregationErrors{ + ErrUniqueH3AggregationPkey: &UniqueConstraintError{ + schema: "", + table: "h3_aggregation", + columns: []string{"id"}, + s: "h3_aggregation_pkey", + }, + + ErrUniqueH3AggregationCellOrganizationIdType_Key: &UniqueConstraintError{ + schema: "", + table: "h3_aggregation", + columns: []string{"cell", "organization_id", "type_"}, + s: "h3_aggregation_cell_organization_id_type__key", + }, +} + +type h3AggregationErrors struct { + ErrUniqueH3AggregationPkey *UniqueConstraintError + + ErrUniqueH3AggregationCellOrganizationIdType_Key *UniqueConstraintError +} diff --git a/dberrors/h3_aggregation.bob_test.go b/dberrors/h3_aggregation.bob_test.go new file mode 100644 index 00000000..8e143f07 --- /dev/null +++ b/dberrors/h3_aggregation.bob_test.go @@ -0,0 +1,110 @@ +// 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 dberrors + +import ( + "context" + "errors" + "testing" + + factory "github.com/Gleipnir-Technology/nidus-sync/factory" + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/stephenafamo/bob" +) + +func TestH3AggregationUniqueConstraintErrors(t *testing.T) { + if testDB == nil { + t.Skip("No database connection provided") + } + + f := factory.New() + tests := []struct { + name string + expectedErr *UniqueConstraintError + conflictMods func(context.Context, *testing.T, bob.Executor, *models.H3Aggregation) factory.H3AggregationModSlice + }{ + { + name: "ErrUniqueH3AggregationPkey", + expectedErr: H3AggregationErrors.ErrUniqueH3AggregationPkey, + conflictMods: func(ctx context.Context, t *testing.T, exec bob.Executor, obj *models.H3Aggregation) factory.H3AggregationModSlice { + shouldUpdate := false + updateMods := make(factory.H3AggregationModSlice, 0, 1) + + if shouldUpdate { + if err := obj.Update(ctx, exec, f.NewH3AggregationWithContext(ctx, updateMods...).BuildSetter()); err != nil { + t.Fatalf("Error updating object: %v", err) + } + } + + return factory.H3AggregationModSlice{ + factory.H3AggregationMods.ID(obj.ID), + } + }, + }, + { + name: "ErrUniqueH3AggregationCellOrganizationIdType_Key", + expectedErr: H3AggregationErrors.ErrUniqueH3AggregationCellOrganizationIdType_Key, + conflictMods: func(ctx context.Context, t *testing.T, exec bob.Executor, obj *models.H3Aggregation) factory.H3AggregationModSlice { + shouldUpdate := false + updateMods := make(factory.H3AggregationModSlice, 0, 3) + + if shouldUpdate { + if err := obj.Update(ctx, exec, f.NewH3AggregationWithContext(ctx, updateMods...).BuildSetter()); err != nil { + t.Fatalf("Error updating object: %v", err) + } + } + + return factory.H3AggregationModSlice{ + factory.H3AggregationMods.Cell(obj.Cell), + factory.H3AggregationMods.OrganizationID(obj.OrganizationID), + factory.H3AggregationMods.Type(obj.Type), + } + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx, cancel := context.WithCancel(t.Context()) + t.Cleanup(cancel) + + tx, err := testDB.Begin(ctx) + if err != nil { + t.Fatalf("Couldn't start database transaction: %v", err) + } + + defer func() { + if err := tx.Rollback(ctx); err != nil { + t.Fatalf("Error rolling back transaction: %v", err) + } + }() + + var exec bob.Executor = tx + + obj, err := f.NewH3AggregationWithContext(ctx, factory.H3AggregationMods.WithParentsCascading()).Create(ctx, exec) + if err != nil { + t.Fatal(err) + } + + obj2, err := f.NewH3AggregationWithContext(ctx).Create(ctx, exec) + if err != nil { + t.Fatal(err) + } + + err = obj2.Update(ctx, exec, f.NewH3AggregationWithContext(ctx, tt.conflictMods(ctx, t, exec, obj)...).BuildSetter()) + if !errors.Is(ErrUniqueConstraint, err) { + t.Fatalf("Expected: %s, Got: %v", tt.name, err) + } + if !errors.Is(tt.expectedErr, err) { + t.Fatalf("Expected: %s, Got: %v", tt.expectedErr.Error(), err) + } + if !ErrUniqueConstraint.Is(err) { + t.Fatalf("Expected: %s, Got: %v", tt.name, err) + } + if !tt.expectedErr.Is(err) { + t.Fatalf("Expected: %s, Got: %v", tt.expectedErr.Error(), err) + } + }) + } +} diff --git a/dberrors/spatial_ref_sys.bob.go b/dberrors/spatial_ref_sys.bob.go new file mode 100644 index 00000000..dc348773 --- /dev/null +++ b/dberrors/spatial_ref_sys.bob.go @@ -0,0 +1,17 @@ +// 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 dberrors + +var SpatialRefSyErrors = &spatialRefSyErrors{ + ErrUniqueSpatialRefSysPkey: &UniqueConstraintError{ + schema: "", + table: "spatial_ref_sys", + columns: []string{"srid"}, + s: "spatial_ref_sys_pkey", + }, +} + +type spatialRefSyErrors struct { + ErrUniqueSpatialRefSysPkey *UniqueConstraintError +} diff --git a/dbinfo/fs_containerrelate.bob.go b/dbinfo/fs_containerrelate.bob.go index 74ae0d57..13c9cc0f 100644 --- a/dbinfo/fs_containerrelate.bob.go +++ b/dbinfo/fs_containerrelate.bob.go @@ -72,9 +72,9 @@ var FSContainerrelates = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_fieldscoutinglog.bob.go b/dbinfo/fs_fieldscoutinglog.bob.go index 099a60ed..17cfa9b4 100644 --- a/dbinfo/fs_fieldscoutinglog.bob.go +++ b/dbinfo/fs_fieldscoutinglog.bob.go @@ -63,9 +63,9 @@ var FSFieldscoutinglogs = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_habitatrelate.bob.go b/dbinfo/fs_habitatrelate.bob.go index 72e63fea..e23ddd0b 100644 --- a/dbinfo/fs_habitatrelate.bob.go +++ b/dbinfo/fs_habitatrelate.bob.go @@ -72,9 +72,9 @@ var FSHabitatrelates = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_inspectionsample.bob.go b/dbinfo/fs_inspectionsample.bob.go index 059fff82..63c73fc5 100644 --- a/dbinfo/fs_inspectionsample.bob.go +++ b/dbinfo/fs_inspectionsample.bob.go @@ -63,9 +63,9 @@ var FSInspectionsamples = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_inspectionsampledetail.bob.go b/dbinfo/fs_inspectionsampledetail.bob.go index a1cded24..c384869a 100644 --- a/dbinfo/fs_inspectionsampledetail.bob.go +++ b/dbinfo/fs_inspectionsampledetail.bob.go @@ -135,9 +135,9 @@ var FSInspectionsampledetails = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_linelocation.bob.go b/dbinfo/fs_linelocation.bob.go index 5595a947..40e99b23 100644 --- a/dbinfo/fs_linelocation.bob.go +++ b/dbinfo/fs_linelocation.bob.go @@ -117,9 +117,9 @@ var FSLinelocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_locationtracking.bob.go b/dbinfo/fs_locationtracking.bob.go index a83ee1f5..9ed3c3c0 100644 --- a/dbinfo/fs_locationtracking.bob.go +++ b/dbinfo/fs_locationtracking.bob.go @@ -81,9 +81,9 @@ var FSLocationtrackings = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_mosquitoinspection.bob.go b/dbinfo/fs_mosquitoinspection.bob.go index 66cf4a19..b691c8d8 100644 --- a/dbinfo/fs_mosquitoinspection.bob.go +++ b/dbinfo/fs_mosquitoinspection.bob.go @@ -198,9 +198,9 @@ var FSMosquitoinspections = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pointlocation.bob.go b/dbinfo/fs_pointlocation.bob.go index 25e762b9..c5969b8d 100644 --- a/dbinfo/fs_pointlocation.bob.go +++ b/dbinfo/fs_pointlocation.bob.go @@ -108,9 +108,9 @@ var FSPointlocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -387,18 +387,18 @@ var FSPointlocations = Table[ GeometryX: column{ Name: "geometry_x", DBType: "double precision", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, GeometryY: column{ Name: "geometry_y", DBType: "double precision", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_polygonlocation.bob.go b/dbinfo/fs_polygonlocation.bob.go index 9a5ac828..c94baeda 100644 --- a/dbinfo/fs_polygonlocation.bob.go +++ b/dbinfo/fs_polygonlocation.bob.go @@ -126,9 +126,9 @@ var FSPolygonlocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pool.bob.go b/dbinfo/fs_pool.bob.go index 71ce217d..cfdc70dc 100644 --- a/dbinfo/fs_pool.bob.go +++ b/dbinfo/fs_pool.bob.go @@ -117,9 +117,9 @@ var FSPools = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pooldetail.bob.go b/dbinfo/fs_pooldetail.bob.go index ced62a47..0b0fe823 100644 --- a/dbinfo/fs_pooldetail.bob.go +++ b/dbinfo/fs_pooldetail.bob.go @@ -72,9 +72,9 @@ var FSPooldetails = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_proposedtreatmentarea.bob.go b/dbinfo/fs_proposedtreatmentarea.bob.go index 4c9f2006..799cb705 100644 --- a/dbinfo/fs_proposedtreatmentarea.bob.go +++ b/dbinfo/fs_proposedtreatmentarea.bob.go @@ -126,9 +126,9 @@ var FSProposedtreatmentareas = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_qamosquitoinspection.bob.go b/dbinfo/fs_qamosquitoinspection.bob.go index d58944b6..11cf045c 100644 --- a/dbinfo/fs_qamosquitoinspection.bob.go +++ b/dbinfo/fs_qamosquitoinspection.bob.go @@ -153,9 +153,9 @@ var FSQamosquitoinspections = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_rodentlocation.bob.go b/dbinfo/fs_rodentlocation.bob.go index 9dd61c3f..98b7fb47 100644 --- a/dbinfo/fs_rodentlocation.bob.go +++ b/dbinfo/fs_rodentlocation.bob.go @@ -108,9 +108,9 @@ var FSRodentlocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_samplecollection.bob.go b/dbinfo/fs_samplecollection.bob.go index ebca07b5..b7487354 100644 --- a/dbinfo/fs_samplecollection.bob.go +++ b/dbinfo/fs_samplecollection.bob.go @@ -171,9 +171,9 @@ var FSSamplecollections = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_samplelocation.bob.go b/dbinfo/fs_samplelocation.bob.go index 888fe82b..02b16754 100644 --- a/dbinfo/fs_samplelocation.bob.go +++ b/dbinfo/fs_samplelocation.bob.go @@ -117,9 +117,9 @@ var FSSamplelocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_servicerequest.bob.go b/dbinfo/fs_servicerequest.bob.go index 54445a6f..f4520540 100644 --- a/dbinfo/fs_servicerequest.bob.go +++ b/dbinfo/fs_servicerequest.bob.go @@ -297,9 +297,9 @@ var FSServicerequests = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -747,18 +747,18 @@ var FSServicerequests = Table[ GeometryX: column{ Name: "geometry_x", DBType: "double precision", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, GeometryY: column{ Name: "geometry_y", DBType: "double precision", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_speciesabundance.bob.go b/dbinfo/fs_speciesabundance.bob.go index fb38a378..fbe911de 100644 --- a/dbinfo/fs_speciesabundance.bob.go +++ b/dbinfo/fs_speciesabundance.bob.go @@ -99,9 +99,9 @@ var FSSpeciesabundances = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_stormdrain.bob.go b/dbinfo/fs_stormdrain.bob.go index 2ce8fa40..1d653a9a 100644 --- a/dbinfo/fs_stormdrain.bob.go +++ b/dbinfo/fs_stormdrain.bob.go @@ -63,9 +63,9 @@ var FSStormdrains = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_timecard.bob.go b/dbinfo/fs_timecard.bob.go index 8395d0fe..1c50a5d4 100644 --- a/dbinfo/fs_timecard.bob.go +++ b/dbinfo/fs_timecard.bob.go @@ -117,9 +117,9 @@ var FSTimecards = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_trapdata.bob.go b/dbinfo/fs_trapdata.bob.go index 29a07a35..3b40e5de 100644 --- a/dbinfo/fs_trapdata.bob.go +++ b/dbinfo/fs_trapdata.bob.go @@ -117,9 +117,9 @@ var FSTrapdata = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_traplocation.bob.go b/dbinfo/fs_traplocation.bob.go index 9c853c6c..62dedc80 100644 --- a/dbinfo/fs_traplocation.bob.go +++ b/dbinfo/fs_traplocation.bob.go @@ -117,9 +117,9 @@ var FSTraplocations = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_treatment.bob.go b/dbinfo/fs_treatment.bob.go index 01e4971b..06bd164c 100644 --- a/dbinfo/fs_treatment.bob.go +++ b/dbinfo/fs_treatment.bob.go @@ -162,9 +162,9 @@ var FSTreatments = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_treatmentarea.bob.go b/dbinfo/fs_treatmentarea.bob.go index 80402b68..5db5d545 100644 --- a/dbinfo/fs_treatmentarea.bob.go +++ b/dbinfo/fs_treatmentarea.bob.go @@ -72,9 +72,9 @@ var FSTreatmentareas = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_zones.bob.go b/dbinfo/fs_zones.bob.go index 77ebd5b0..280405f0 100644 --- a/dbinfo/fs_zones.bob.go +++ b/dbinfo/fs_zones.bob.go @@ -72,9 +72,9 @@ var FSZones = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_zones2.bob.go b/dbinfo/fs_zones2.bob.go index d96279e9..150be8de 100644 --- a/dbinfo/fs_zones2.bob.go +++ b/dbinfo/fs_zones2.bob.go @@ -63,9 +63,9 @@ var FSZones2s = Table[ Globalid: column{ Name: "globalid", DBType: "text", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/geography_columns.bob.go b/dbinfo/geography_columns.bob.go new file mode 100644 index 00000000..c421ab69 --- /dev/null +++ b/dbinfo/geography_columns.bob.go @@ -0,0 +1,122 @@ +// 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 dbinfo + +var GeographyColumns = Table[ + geographyColumnColumns, + geographyColumnIndexes, + geographyColumnForeignKeys, + geographyColumnUniques, + geographyColumnChecks, +]{ + Schema: "", + Name: "geography_columns", + Columns: geographyColumnColumns{ + FTableCatalog: column{ + Name: "f_table_catalog", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FTableSchema: column{ + Name: "f_table_schema", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FTableName: column{ + Name: "f_table_name", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FGeographyColumn: column{ + Name: "f_geography_column", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CoordDimension: column{ + Name: "coord_dimension", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + + Comment: "", +} + +type geographyColumnColumns struct { + FTableCatalog column + FTableSchema column + FTableName column + FGeographyColumn column + CoordDimension column + Srid column + Type column +} + +func (c geographyColumnColumns) AsSlice() []column { + return []column{ + c.FTableCatalog, c.FTableSchema, c.FTableName, c.FGeographyColumn, c.CoordDimension, c.Srid, c.Type, + } +} + +type geographyColumnIndexes struct{} + +func (i geographyColumnIndexes) AsSlice() []index { + return []index{} +} + +type geographyColumnForeignKeys struct{} + +func (f geographyColumnForeignKeys) AsSlice() []foreignKey { + return []foreignKey{} +} + +type geographyColumnUniques struct{} + +func (u geographyColumnUniques) AsSlice() []constraint { + return []constraint{} +} + +type geographyColumnChecks struct{} + +func (c geographyColumnChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/geometry_columns.bob.go b/dbinfo/geometry_columns.bob.go new file mode 100644 index 00000000..cb6f339a --- /dev/null +++ b/dbinfo/geometry_columns.bob.go @@ -0,0 +1,122 @@ +// 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 dbinfo + +var GeometryColumns = Table[ + geometryColumnColumns, + geometryColumnIndexes, + geometryColumnForeignKeys, + geometryColumnUniques, + geometryColumnChecks, +]{ + Schema: "", + Name: "geometry_columns", + Columns: geometryColumnColumns{ + FTableCatalog: column{ + Name: "f_table_catalog", + DBType: "character varying", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FTableSchema: column{ + Name: "f_table_schema", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FTableName: column{ + Name: "f_table_name", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + FGeometryColumn: column{ + Name: "f_geometry_column", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + CoordDimension: column{ + Name: "coord_dimension", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type", + DBType: "character varying", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + + Comment: "", +} + +type geometryColumnColumns struct { + FTableCatalog column + FTableSchema column + FTableName column + FGeometryColumn column + CoordDimension column + Srid column + Type column +} + +func (c geometryColumnColumns) AsSlice() []column { + return []column{ + c.FTableCatalog, c.FTableSchema, c.FTableName, c.FGeometryColumn, c.CoordDimension, c.Srid, c.Type, + } +} + +type geometryColumnIndexes struct{} + +func (i geometryColumnIndexes) AsSlice() []index { + return []index{} +} + +type geometryColumnForeignKeys struct{} + +func (f geometryColumnForeignKeys) AsSlice() []foreignKey { + return []foreignKey{} +} + +type geometryColumnUniques struct{} + +func (u geometryColumnUniques) AsSlice() []constraint { + return []constraint{} +} + +type geometryColumnChecks struct{} + +func (c geometryColumnChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/h3_aggregation.bob.go b/dbinfo/h3_aggregation.bob.go new file mode 100644 index 00000000..1aed4de0 --- /dev/null +++ b/dbinfo/h3_aggregation.bob.go @@ -0,0 +1,196 @@ +// 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 dbinfo + +import "github.com/aarondl/opt/null" + +var H3Aggregations = Table[ + h3AggregationColumns, + h3AggregationIndexes, + h3AggregationForeignKeys, + h3AggregationUniques, + h3AggregationChecks, +]{ + Schema: "", + Name: "h3_aggregation", + Columns: h3AggregationColumns{ + ID: column{ + Name: "id", + DBType: "integer", + Default: "nextval('h3_aggregation_id_seq'::regclass)", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Cell: column{ + Name: "cell", + DBType: "h3index", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Resolution: column{ + Name: "resolution", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Count: column{ + Name: "count_", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type_", + DBType: "public.h3aggregationtype", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: h3AggregationIndexes{ + H3AggregationPkey: index{ + Type: "btree", + Name: "h3_aggregation_pkey", + Columns: []indexColumn{ + { + Name: "id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + H3AggregationCellOrganizationIDTypeKey: index{ + Type: "btree", + Name: "h3_aggregation_cell_organization_id_type__key", + Columns: []indexColumn{ + { + Name: "cell", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "organization_id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "type_", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "h3_aggregation_pkey", + Columns: []string{"id"}, + Comment: "", + }, + ForeignKeys: h3AggregationForeignKeys{ + H3AggregationH3AggregationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "h3_aggregation.h3_aggregation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + Uniques: h3AggregationUniques{ + H3AggregationCellOrganizationIDTypeKey: constraint{ + Name: "h3_aggregation_cell_organization_id_type__key", + Columns: []string{"cell", "organization_id", "type_"}, + Comment: "", + }, + }, + + Comment: "", +} + +type h3AggregationColumns struct { + ID column + Cell column + Resolution column + Count column + Type column + OrganizationID column +} + +func (c h3AggregationColumns) AsSlice() []column { + return []column{ + c.ID, c.Cell, c.Resolution, c.Count, c.Type, c.OrganizationID, + } +} + +type h3AggregationIndexes struct { + H3AggregationPkey index + H3AggregationCellOrganizationIDTypeKey index +} + +func (i h3AggregationIndexes) AsSlice() []index { + return []index{ + i.H3AggregationPkey, i.H3AggregationCellOrganizationIDTypeKey, + } +} + +type h3AggregationForeignKeys struct { + H3AggregationH3AggregationOrganizationIDFkey foreignKey +} + +func (f h3AggregationForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.H3AggregationH3AggregationOrganizationIDFkey, + } +} + +type h3AggregationUniques struct { + H3AggregationCellOrganizationIDTypeKey constraint +} + +func (u h3AggregationUniques) AsSlice() []constraint { + return []constraint{ + u.H3AggregationCellOrganizationIDTypeKey, + } +} + +type h3AggregationChecks struct{} + +func (c h3AggregationChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/raster_columns.bob.go b/dbinfo/raster_columns.bob.go new file mode 100644 index 00000000..13ea9f8a --- /dev/null +++ b/dbinfo/raster_columns.bob.go @@ -0,0 +1,222 @@ +// 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 dbinfo + +var RasterColumns = Table[ + rasterColumnColumns, + rasterColumnIndexes, + rasterColumnForeignKeys, + rasterColumnUniques, + rasterColumnChecks, +]{ + Schema: "", + Name: "raster_columns", + Columns: rasterColumnColumns{ + RTableCatalog: column{ + Name: "r_table_catalog", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RTableSchema: column{ + Name: "r_table_schema", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RTableName: column{ + Name: "r_table_name", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RRasterColumn: column{ + Name: "r_raster_column", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srid: column{ + Name: "srid", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ScaleX: column{ + Name: "scale_x", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ScaleY: column{ + Name: "scale_y", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + BlocksizeX: column{ + Name: "blocksize_x", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + BlocksizeY: column{ + Name: "blocksize_y", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SameAlignment: column{ + Name: "same_alignment", + DBType: "boolean", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RegularBlocking: column{ + Name: "regular_blocking", + DBType: "boolean", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + NumBands: column{ + Name: "num_bands", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + PixelTypes: column{ + Name: "pixel_types", + DBType: "text[]", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + NodataValues: column{ + Name: "nodata_values", + DBType: "double precision[]", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + OutDB: column{ + Name: "out_db", + DBType: "boolean[]", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Extent: column{ + Name: "extent", + DBType: "geometry", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + SpatialIndex: column{ + Name: "spatial_index", + DBType: "boolean", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + + Comment: "", +} + +type rasterColumnColumns struct { + RTableCatalog column + RTableSchema column + RTableName column + RRasterColumn column + Srid column + ScaleX column + ScaleY column + BlocksizeX column + BlocksizeY column + SameAlignment column + RegularBlocking column + NumBands column + PixelTypes column + NodataValues column + OutDB column + Extent column + SpatialIndex column +} + +func (c rasterColumnColumns) AsSlice() []column { + return []column{ + c.RTableCatalog, c.RTableSchema, c.RTableName, c.RRasterColumn, c.Srid, c.ScaleX, c.ScaleY, c.BlocksizeX, c.BlocksizeY, c.SameAlignment, c.RegularBlocking, c.NumBands, c.PixelTypes, c.NodataValues, c.OutDB, c.Extent, c.SpatialIndex, + } +} + +type rasterColumnIndexes struct{} + +func (i rasterColumnIndexes) AsSlice() []index { + return []index{} +} + +type rasterColumnForeignKeys struct{} + +func (f rasterColumnForeignKeys) AsSlice() []foreignKey { + return []foreignKey{} +} + +type rasterColumnUniques struct{} + +func (u rasterColumnUniques) AsSlice() []constraint { + return []constraint{} +} + +type rasterColumnChecks struct{} + +func (c rasterColumnChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/raster_overviews.bob.go b/dbinfo/raster_overviews.bob.go new file mode 100644 index 00000000..723291f3 --- /dev/null +++ b/dbinfo/raster_overviews.bob.go @@ -0,0 +1,142 @@ +// 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 dbinfo + +var RasterOverviews = Table[ + rasterOverviewColumns, + rasterOverviewIndexes, + rasterOverviewForeignKeys, + rasterOverviewUniques, + rasterOverviewChecks, +]{ + Schema: "", + Name: "raster_overviews", + Columns: rasterOverviewColumns{ + OTableCatalog: column{ + Name: "o_table_catalog", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + OTableSchema: column{ + Name: "o_table_schema", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + OTableName: column{ + Name: "o_table_name", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ORasterColumn: column{ + Name: "o_raster_column", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RTableCatalog: column{ + Name: "r_table_catalog", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RTableSchema: column{ + Name: "r_table_schema", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RTableName: column{ + Name: "r_table_name", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + RRasterColumn: column{ + Name: "r_raster_column", + DBType: "name", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + OverviewFactor: column{ + Name: "overview_factor", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + + Comment: "", +} + +type rasterOverviewColumns struct { + OTableCatalog column + OTableSchema column + OTableName column + ORasterColumn column + RTableCatalog column + RTableSchema column + RTableName column + RRasterColumn column + OverviewFactor column +} + +func (c rasterOverviewColumns) AsSlice() []column { + return []column{ + c.OTableCatalog, c.OTableSchema, c.OTableName, c.ORasterColumn, c.RTableCatalog, c.RTableSchema, c.RTableName, c.RRasterColumn, c.OverviewFactor, + } +} + +type rasterOverviewIndexes struct{} + +func (i rasterOverviewIndexes) AsSlice() []index { + return []index{} +} + +type rasterOverviewForeignKeys struct{} + +func (f rasterOverviewForeignKeys) AsSlice() []foreignKey { + return []foreignKey{} +} + +type rasterOverviewUniques struct{} + +func (u rasterOverviewUniques) AsSlice() []constraint { + return []constraint{} +} + +type rasterOverviewChecks struct{} + +func (c rasterOverviewChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/spatial_ref_sys.bob.go b/dbinfo/spatial_ref_sys.bob.go new file mode 100644 index 00000000..555b7497 --- /dev/null +++ b/dbinfo/spatial_ref_sys.bob.go @@ -0,0 +1,146 @@ +// 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 dbinfo + +import "github.com/aarondl/opt/null" + +var SpatialRefSys = Table[ + spatialRefSyColumns, + spatialRefSyIndexes, + spatialRefSyForeignKeys, + spatialRefSyUniques, + spatialRefSyChecks, +]{ + Schema: "", + Name: "spatial_ref_sys", + Columns: spatialRefSyColumns{ + Srid: column{ + Name: "srid", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + AuthName: column{ + Name: "auth_name", + DBType: "character varying", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + AuthSrid: column{ + Name: "auth_srid", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Srtext: column{ + Name: "srtext", + DBType: "character varying", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Proj4text: column{ + Name: "proj4text", + DBType: "character varying", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: spatialRefSyIndexes{ + SpatialRefSysPkey: index{ + Type: "btree", + Name: "spatial_ref_sys_pkey", + Columns: []indexColumn{ + { + Name: "srid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "spatial_ref_sys_pkey", + Columns: []string{"srid"}, + Comment: "", + }, + + Checks: spatialRefSyChecks{ + SpatialRefSysSridCheck: check{ + constraint: constraint{ + Name: "spatial_ref_sys_srid_check", + Columns: []string{"srid"}, + Comment: "", + }, + Expression: "((srid > 0) AND (srid <= 998999))", + }, + }, + Comment: "", +} + +type spatialRefSyColumns struct { + Srid column + AuthName column + AuthSrid column + Srtext column + Proj4text column +} + +func (c spatialRefSyColumns) AsSlice() []column { + return []column{ + c.Srid, c.AuthName, c.AuthSrid, c.Srtext, c.Proj4text, + } +} + +type spatialRefSyIndexes struct { + SpatialRefSysPkey index +} + +func (i spatialRefSyIndexes) AsSlice() []index { + return []index{ + i.SpatialRefSysPkey, + } +} + +type spatialRefSyForeignKeys struct{} + +func (f spatialRefSyForeignKeys) AsSlice() []foreignKey { + return []foreignKey{} +} + +type spatialRefSyUniques struct{} + +func (u spatialRefSyUniques) AsSlice() []constraint { + return []constraint{} +} + +type spatialRefSyChecks struct { + SpatialRefSysSridCheck check +} + +func (c spatialRefSyChecks) AsSlice() []check { + return []check{ + c.SpatialRefSysSridCheck, + } +} diff --git a/enums/enums.bob.go b/enums/enums.bob.go index 4f38af90..2750bb05 100644 --- a/enums/enums.bob.go +++ b/enums/enums.bob.go @@ -117,6 +117,79 @@ func (e *Arcgislicensetype) Scan(value any) error { return nil } +// Enum values for H3aggregationtype +const ( + H3aggregationtypeMosquitosource H3aggregationtype = "MosquitoSource" + H3aggregationtypeServicerequest H3aggregationtype = "ServiceRequest" +) + +func AllH3aggregationtype() []H3aggregationtype { + return []H3aggregationtype{ + H3aggregationtypeMosquitosource, + H3aggregationtypeServicerequest, + } +} + +type H3aggregationtype string + +func (e H3aggregationtype) String() string { + return string(e) +} + +func (e H3aggregationtype) Valid() bool { + switch e { + case H3aggregationtypeMosquitosource, + H3aggregationtypeServicerequest: + return true + default: + return false + } +} + +// useful when testing in other packages +func (e H3aggregationtype) All() []H3aggregationtype { + return AllH3aggregationtype() +} + +func (e H3aggregationtype) MarshalText() ([]byte, error) { + return []byte(e), nil +} + +func (e *H3aggregationtype) UnmarshalText(text []byte) error { + return e.Scan(text) +} + +func (e H3aggregationtype) MarshalBinary() ([]byte, error) { + return []byte(e), nil +} + +func (e *H3aggregationtype) UnmarshalBinary(data []byte) error { + return e.Scan(data) +} + +func (e H3aggregationtype) Value() (driver.Value, error) { + return string(e), nil +} + +func (e *H3aggregationtype) Scan(value any) error { + switch x := value.(type) { + case string: + *e = H3aggregationtype(x) + case []byte: + *e = H3aggregationtype(x) + case nil: + return fmt.Errorf("cannot nil into H3aggregationtype") + default: + return fmt.Errorf("cannot scan type %T: %v", value, value) + } + + if !e.Valid() { + return fmt.Errorf("invalid H3aggregationtype value: %s", *e) + } + + return nil +} + // Enum values for Hashtype const ( HashtypeBcrypt14 Hashtype = "bcrypt-14" diff --git a/factory/bobfactory_context.bob.go b/factory/bobfactory_context.bob.go index b80fb70e..a9802ecc 100644 --- a/factory/bobfactory_context.bob.go +++ b/factory/bobfactory_context.bob.go @@ -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") diff --git a/factory/bobfactory_main.bob.go b/factory/bobfactory_main.bob.go index b3ce9566..0e299623 100644 --- a/factory/bobfactory_main.bob.go +++ b/factory/bobfactory_main.bob.go @@ -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 } diff --git a/factory/bobfactory_main.bob_test.go b/factory/bobfactory_main.bob_test.go index b8ee4f6a..e03e4739 100644 --- a/factory/bobfactory_main.bob_test.go +++ b/factory/bobfactory_main.bob_test.go @@ -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") diff --git a/factory/bobfactory_random.bob.go b/factory/bobfactory_random.bob.go index 7ae36acd..d00969e2 100644 --- a/factory/bobfactory_random.bob.go +++ b/factory/bobfactory_random.bob.go @@ -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 diff --git a/factory/bobfactory_random.bob_test.go b/factory/bobfactory_random.bob_test.go index e0de4b1c..d9fb4846 100644 --- a/factory/bobfactory_random.bob_test.go +++ b/factory/bobfactory_random.bob_test.go @@ -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() diff --git a/factory/fs_containerrelate.bob.go b/factory/fs_containerrelate.bob.go index aaa74e16..46608052 100644 --- a/factory/fs_containerrelate.bob.go +++ b/factory/fs_containerrelate.bob.go @@ -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) } }) } diff --git a/factory/fs_fieldscoutinglog.bob.go b/factory/fs_fieldscoutinglog.bob.go index 0720c278..7f1a30e9 100644 --- a/factory/fs_fieldscoutinglog.bob.go +++ b/factory/fs_fieldscoutinglog.bob.go @@ -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) } }) } diff --git a/factory/fs_habitatrelate.bob.go b/factory/fs_habitatrelate.bob.go index 70bd484b..c17ccba8 100644 --- a/factory/fs_habitatrelate.bob.go +++ b/factory/fs_habitatrelate.bob.go @@ -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) } }) } diff --git a/factory/fs_inspectionsample.bob.go b/factory/fs_inspectionsample.bob.go index 7e495db7..21d047ae 100644 --- a/factory/fs_inspectionsample.bob.go +++ b/factory/fs_inspectionsample.bob.go @@ -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) } }) } diff --git a/factory/fs_inspectionsampledetail.bob.go b/factory/fs_inspectionsampledetail.bob.go index 7a34ddb3..fe3c7dd9 100644 --- a/factory/fs_inspectionsampledetail.bob.go +++ b/factory/fs_inspectionsampledetail.bob.go @@ -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) } }) } diff --git a/factory/fs_linelocation.bob.go b/factory/fs_linelocation.bob.go index 2238698b..111aa1ea 100644 --- a/factory/fs_linelocation.bob.go +++ b/factory/fs_linelocation.bob.go @@ -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) } }) } diff --git a/factory/fs_locationtracking.bob.go b/factory/fs_locationtracking.bob.go index 21925d9c..685539c7 100644 --- a/factory/fs_locationtracking.bob.go +++ b/factory/fs_locationtracking.bob.go @@ -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) } }) } diff --git a/factory/fs_mosquitoinspection.bob.go b/factory/fs_mosquitoinspection.bob.go index 0e7d2a13..9c9fd7f3 100644 --- a/factory/fs_mosquitoinspection.bob.go +++ b/factory/fs_mosquitoinspection.bob.go @@ -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) } }) } diff --git a/factory/fs_pointlocation.bob.go b/factory/fs_pointlocation.bob.go index f3fb73fc..86112f6c 100644 --- a/factory/fs_pointlocation.bob.go +++ b/factory/fs_pointlocation.bob.go @@ -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) } }) } diff --git a/factory/fs_polygonlocation.bob.go b/factory/fs_polygonlocation.bob.go index ea819efa..5b4deaa7 100644 --- a/factory/fs_polygonlocation.bob.go +++ b/factory/fs_polygonlocation.bob.go @@ -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) } }) } diff --git a/factory/fs_pool.bob.go b/factory/fs_pool.bob.go index ce005bfc..3080b7ff 100644 --- a/factory/fs_pool.bob.go +++ b/factory/fs_pool.bob.go @@ -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) } }) } diff --git a/factory/fs_pooldetail.bob.go b/factory/fs_pooldetail.bob.go index b923d55d..3df0f6f7 100644 --- a/factory/fs_pooldetail.bob.go +++ b/factory/fs_pooldetail.bob.go @@ -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) } }) } diff --git a/factory/fs_proposedtreatmentarea.bob.go b/factory/fs_proposedtreatmentarea.bob.go index 53367925..04d329bc 100644 --- a/factory/fs_proposedtreatmentarea.bob.go +++ b/factory/fs_proposedtreatmentarea.bob.go @@ -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) } }) } diff --git a/factory/fs_qamosquitoinspection.bob.go b/factory/fs_qamosquitoinspection.bob.go index dba27de0..334c1efa 100644 --- a/factory/fs_qamosquitoinspection.bob.go +++ b/factory/fs_qamosquitoinspection.bob.go @@ -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) } }) } diff --git a/factory/fs_rodentlocation.bob.go b/factory/fs_rodentlocation.bob.go index 7804b0fd..8dc3e1b6 100644 --- a/factory/fs_rodentlocation.bob.go +++ b/factory/fs_rodentlocation.bob.go @@ -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) } }) } diff --git a/factory/fs_samplecollection.bob.go b/factory/fs_samplecollection.bob.go index b69883b0..92e6fbce 100644 --- a/factory/fs_samplecollection.bob.go +++ b/factory/fs_samplecollection.bob.go @@ -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) } }) } diff --git a/factory/fs_samplelocation.bob.go b/factory/fs_samplelocation.bob.go index 2303810f..03037287 100644 --- a/factory/fs_samplelocation.bob.go +++ b/factory/fs_samplelocation.bob.go @@ -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) } }) } diff --git a/factory/fs_servicerequest.bob.go b/factory/fs_servicerequest.bob.go index 10f9ecd3..0a1002bc 100644 --- a/factory/fs_servicerequest.bob.go +++ b/factory/fs_servicerequest.bob.go @@ -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) } }) } diff --git a/factory/fs_speciesabundance.bob.go b/factory/fs_speciesabundance.bob.go index e26c08aa..a0b3e9f6 100644 --- a/factory/fs_speciesabundance.bob.go +++ b/factory/fs_speciesabundance.bob.go @@ -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) } }) } diff --git a/factory/fs_stormdrain.bob.go b/factory/fs_stormdrain.bob.go index 95fbce2a..2939e845 100644 --- a/factory/fs_stormdrain.bob.go +++ b/factory/fs_stormdrain.bob.go @@ -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) } }) } diff --git a/factory/fs_timecard.bob.go b/factory/fs_timecard.bob.go index 0291b2e6..326e4afd 100644 --- a/factory/fs_timecard.bob.go +++ b/factory/fs_timecard.bob.go @@ -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) } }) } diff --git a/factory/fs_trapdata.bob.go b/factory/fs_trapdata.bob.go index a6b6a1af..baa9c140 100644 --- a/factory/fs_trapdata.bob.go +++ b/factory/fs_trapdata.bob.go @@ -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) } }) } diff --git a/factory/fs_traplocation.bob.go b/factory/fs_traplocation.bob.go index e7641229..b8faef08 100644 --- a/factory/fs_traplocation.bob.go +++ b/factory/fs_traplocation.bob.go @@ -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) } }) } diff --git a/factory/fs_treatment.bob.go b/factory/fs_treatment.bob.go index df23dfd5..84e060d1 100644 --- a/factory/fs_treatment.bob.go +++ b/factory/fs_treatment.bob.go @@ -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) } }) } diff --git a/factory/fs_treatmentarea.bob.go b/factory/fs_treatmentarea.bob.go index fa157ce6..7ca571a1 100644 --- a/factory/fs_treatmentarea.bob.go +++ b/factory/fs_treatmentarea.bob.go @@ -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) } }) } diff --git a/factory/fs_zones.bob.go b/factory/fs_zones.bob.go index 61312134..abbba866 100644 --- a/factory/fs_zones.bob.go +++ b/factory/fs_zones.bob.go @@ -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) } }) } diff --git a/factory/fs_zones2.bob.go b/factory/fs_zones2.bob.go index ec06b747..b5756779 100644 --- a/factory/fs_zones2.bob.go +++ b/factory/fs_zones2.bob.go @@ -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) } }) } diff --git a/factory/geography_columns.bob.go b/factory/geography_columns.bob.go new file mode 100644 index 00000000..b46312bf --- /dev/null +++ b/factory/geography_columns.bob.go @@ -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) + }) +} diff --git a/factory/geometry_columns.bob.go b/factory/geometry_columns.bob.go new file mode 100644 index 00000000..7afbe148 --- /dev/null +++ b/factory/geometry_columns.bob.go @@ -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) + }) +} diff --git a/factory/h3_aggregation.bob.go b/factory/h3_aggregation.bob.go new file mode 100644 index 00000000..41b0c677 --- /dev/null +++ b/factory/h3_aggregation.bob.go @@ -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 + }) +} diff --git a/factory/organization.bob.go b/factory/organization.bob.go index fcd40657..4dc369da 100644 --- a/factory/organization.bob.go +++ b/factory/organization.bob.go @@ -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{{ diff --git a/factory/raster_columns.bob.go b/factory/raster_columns.bob.go new file mode 100644 index 00000000..777af7e0 --- /dev/null +++ b/factory/raster_columns.bob.go @@ -0,0 +1,1081 @@ +// 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" + "github.com/lib/pq" +) + +type RasterColumnMod interface { + Apply(context.Context, *RasterColumnTemplate) +} + +type RasterColumnModFunc func(context.Context, *RasterColumnTemplate) + +func (f RasterColumnModFunc) Apply(ctx context.Context, n *RasterColumnTemplate) { + f(ctx, n) +} + +type RasterColumnModSlice []RasterColumnMod + +func (mods RasterColumnModSlice) Apply(ctx context.Context, n *RasterColumnTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// RasterColumnTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type RasterColumnTemplate struct { + RTableCatalog func() null.Val[string] + RTableSchema func() null.Val[string] + RTableName func() null.Val[string] + RRasterColumn func() null.Val[string] + Srid func() null.Val[int32] + ScaleX func() null.Val[float64] + ScaleY func() null.Val[float64] + BlocksizeX func() null.Val[int32] + BlocksizeY func() null.Val[int32] + SameAlignment func() null.Val[bool] + RegularBlocking func() null.Val[bool] + NumBands func() null.Val[int32] + PixelTypes func() null.Val[pq.StringArray] + NodataValues func() null.Val[pq.Float64Array] + OutDB func() null.Val[pq.BoolArray] + Extent func() null.Val[string] + SpatialIndex func() null.Val[bool] + + f *Factory + + alreadyPersisted bool +} + +// Apply mods to the RasterColumnTemplate +func (o *RasterColumnTemplate) Apply(ctx context.Context, mods ...RasterColumnMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.RasterColumn +// according to the relationships in the template. Nothing is inserted into the db +func (t RasterColumnTemplate) setModelRels(o *models.RasterColumn) {} + +// Build returns an *models.RasterColumn +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use RasterColumnTemplate.Create +func (o RasterColumnTemplate) Build() *models.RasterColumn { + m := &models.RasterColumn{} + + 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.Srid != nil { + m.Srid = o.Srid() + } + if o.ScaleX != nil { + m.ScaleX = o.ScaleX() + } + if o.ScaleY != nil { + m.ScaleY = o.ScaleY() + } + if o.BlocksizeX != nil { + m.BlocksizeX = o.BlocksizeX() + } + if o.BlocksizeY != nil { + m.BlocksizeY = o.BlocksizeY() + } + if o.SameAlignment != nil { + m.SameAlignment = o.SameAlignment() + } + if o.RegularBlocking != nil { + m.RegularBlocking = o.RegularBlocking() + } + if o.NumBands != nil { + m.NumBands = o.NumBands() + } + if o.PixelTypes != nil { + m.PixelTypes = o.PixelTypes() + } + if o.NodataValues != nil { + m.NodataValues = o.NodataValues() + } + if o.OutDB != nil { + m.OutDB = o.OutDB() + } + if o.Extent != nil { + m.Extent = o.Extent() + } + if o.SpatialIndex != nil { + m.SpatialIndex = o.SpatialIndex() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.RasterColumnSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use RasterColumnTemplate.CreateMany +func (o RasterColumnTemplate) BuildMany(number int) models.RasterColumnSlice { + m := make(models.RasterColumnSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +// RasterColumn has methods that act as mods for the RasterColumnTemplate +var RasterColumnMods rasterColumnMods + +type rasterColumnMods struct{} + +func (m rasterColumnMods) RandomizeAllColumns(f *faker.Faker) RasterColumnMod { + return RasterColumnModSlice{ + RasterColumnMods.RandomRTableCatalog(f), + RasterColumnMods.RandomRTableSchema(f), + RasterColumnMods.RandomRTableName(f), + RasterColumnMods.RandomRRasterColumn(f), + RasterColumnMods.RandomSrid(f), + RasterColumnMods.RandomScaleX(f), + RasterColumnMods.RandomScaleY(f), + RasterColumnMods.RandomBlocksizeX(f), + RasterColumnMods.RandomBlocksizeY(f), + RasterColumnMods.RandomSameAlignment(f), + RasterColumnMods.RandomRegularBlocking(f), + RasterColumnMods.RandomNumBands(f), + RasterColumnMods.RandomPixelTypes(f), + RasterColumnMods.RandomNodataValues(f), + RasterColumnMods.RandomOutDB(f), + RasterColumnMods.RandomExtent(f), + RasterColumnMods.RandomSpatialIndex(f), + } +} + +// Set the model columns to this value +func (m rasterColumnMods) RTableCatalog(val null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableCatalog = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) RTableCatalogFunc(f func() null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableCatalog = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetRTableCatalog() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableCatalog(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableCatalogNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RTableSchema(val null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableSchema = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) RTableSchemaFunc(f func() null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableSchema = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetRTableSchema() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableSchema(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableSchemaNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RTableName(val null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableName = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) RTableNameFunc(f func() null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RTableName = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetRTableName() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableName(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRTableNameNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RRasterColumn(val null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RRasterColumn = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) RRasterColumnFunc(f func() null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RRasterColumn = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetRRasterColumn() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRRasterColumn(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomRRasterColumnNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) Srid(val null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Srid = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) SridFunc(f func() null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Srid = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetSrid() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomSrid(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) RandomSridNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + 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 rasterColumnMods) ScaleX(val null.Val[float64]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleX = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) ScaleXFunc(f func() null.Val[float64]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleX = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetScaleX() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleX = 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 rasterColumnMods) RandomScaleX(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleX = 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 rasterColumnMods) RandomScaleXNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleX = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) ScaleY(val null.Val[float64]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleY = func() null.Val[float64] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) ScaleYFunc(f func() null.Val[float64]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleY = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetScaleY() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleY = 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 rasterColumnMods) RandomScaleY(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleY = 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 rasterColumnMods) RandomScaleYNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.ScaleY = func() null.Val[float64] { + if f == nil { + f = &defaultFaker + } + + val := random_float64(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) BlocksizeX(val null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeX = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) BlocksizeXFunc(f func() null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeX = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetBlocksizeX() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeX = 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 rasterColumnMods) RandomBlocksizeX(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeX = 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 rasterColumnMods) RandomBlocksizeXNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeX = 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 rasterColumnMods) BlocksizeY(val null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeY = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) BlocksizeYFunc(f func() null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeY = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetBlocksizeY() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeY = 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 rasterColumnMods) RandomBlocksizeY(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeY = 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 rasterColumnMods) RandomBlocksizeYNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.BlocksizeY = 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 rasterColumnMods) SameAlignment(val null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SameAlignment = func() null.Val[bool] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) SameAlignmentFunc(f func() null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SameAlignment = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetSameAlignment() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SameAlignment = 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 rasterColumnMods) RandomSameAlignment(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SameAlignment = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m rasterColumnMods) RandomSameAlignmentNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SameAlignment = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) RegularBlocking(val null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RegularBlocking = func() null.Val[bool] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) RegularBlockingFunc(f func() null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RegularBlocking = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetRegularBlocking() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RegularBlocking = 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 rasterColumnMods) RandomRegularBlocking(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RegularBlocking = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m rasterColumnMods) RandomRegularBlockingNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.RegularBlocking = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) NumBands(val null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NumBands = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) NumBandsFunc(f func() null.Val[int32]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NumBands = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetNumBands() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NumBands = 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 rasterColumnMods) RandomNumBands(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NumBands = 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 rasterColumnMods) RandomNumBandsNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NumBands = 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 rasterColumnMods) PixelTypes(val null.Val[pq.StringArray]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.PixelTypes = func() null.Val[pq.StringArray] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) PixelTypesFunc(f func() null.Val[pq.StringArray]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.PixelTypes = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetPixelTypes() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.PixelTypes = 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 rasterColumnMods) RandomPixelTypes(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.PixelTypes = func() null.Val[pq.StringArray] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_StringArray(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 rasterColumnMods) RandomPixelTypesNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.PixelTypes = func() null.Val[pq.StringArray] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_StringArray(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) NodataValues(val null.Val[pq.Float64Array]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NodataValues = func() null.Val[pq.Float64Array] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) NodataValuesFunc(f func() null.Val[pq.Float64Array]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NodataValues = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetNodataValues() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NodataValues = 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 rasterColumnMods) RandomNodataValues(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NodataValues = func() null.Val[pq.Float64Array] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_Float64Array(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 rasterColumnMods) RandomNodataValuesNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.NodataValues = func() null.Val[pq.Float64Array] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_Float64Array(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) OutDB(val null.Val[pq.BoolArray]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.OutDB = func() null.Val[pq.BoolArray] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) OutDBFunc(f func() null.Val[pq.BoolArray]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.OutDB = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetOutDB() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.OutDB = 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 rasterColumnMods) RandomOutDB(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.OutDB = func() null.Val[pq.BoolArray] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_BoolArray(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 rasterColumnMods) RandomOutDBNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.OutDB = func() null.Val[pq.BoolArray] { + if f == nil { + f = &defaultFaker + } + + val := random_pq_BoolArray(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m rasterColumnMods) Extent(val null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Extent = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) ExtentFunc(f func() null.Val[string]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Extent = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetExtent() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Extent = 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 rasterColumnMods) RandomExtent(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Extent = 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 rasterColumnMods) RandomExtentNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.Extent = 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 rasterColumnMods) SpatialIndex(val null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SpatialIndex = func() null.Val[bool] { return val } + }) +} + +// Set the Column from the function +func (m rasterColumnMods) SpatialIndexFunc(f func() null.Val[bool]) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SpatialIndex = f + }) +} + +// Clear any values for the column +func (m rasterColumnMods) UnsetSpatialIndex() RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SpatialIndex = 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 rasterColumnMods) RandomSpatialIndex(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SpatialIndex = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m rasterColumnMods) RandomSpatialIndexNotNull(f *faker.Faker) RasterColumnMod { + return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { + o.SpatialIndex = func() null.Val[bool] { + if f == nil { + f = &defaultFaker + } + + val := random_bool(f) + return null.From(val) + } + }) +} + +func (m rasterColumnMods) WithParentsCascading() RasterColumnMod { + return RasterColumnModFunc(func(ctx context.Context, o *RasterColumnTemplate) { + if isDone, _ := rasterColumnWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = rasterColumnWithParentsCascadingCtx.WithValue(ctx, true) + }) +} diff --git a/factory/raster_overviews.bob.go b/factory/raster_overviews.bob.go new file mode 100644 index 00000000..7d9910ea --- /dev/null +++ b/factory/raster_overviews.bob.go @@ -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) + }) +} diff --git a/factory/spatial_ref_sys.bob.go b/factory/spatial_ref_sys.bob.go new file mode 100644 index 00000000..0b84c401 --- /dev/null +++ b/factory/spatial_ref_sys.bob.go @@ -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) + }) +} diff --git a/go.mod b/go.mod index 50abb628..1a59614b 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/stephenafamo/bob v0.41.1 github.com/stephenafamo/scan v0.7.0 github.com/tidwall/geojson v1.4.5 - github.com/uber/h3-go/v3 v3.7.1 + github.com/uber/h3-go/v4 v4.3.0 github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 golang.org/x/crypto v0.42.0 ) @@ -49,6 +49,7 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/rtree v1.3.1 // indirect github.com/tidwall/sjson v1.2.4 // indirect + github.com/uber/h3-go/v3 v3.7.1 // indirect github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect github.com/x448/float16 v0.8.4 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/go.sum b/go.sum index a578ad4d..5eab6415 100644 --- a/go.sum +++ b/go.sum @@ -204,6 +204,8 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/uber/h3-go/v3 v3.7.1 h1:qGAnkRKXHeuaGuLDktcouROiNDE1PgZTgiZGMBwVnSc= github.com/uber/h3-go/v3 v3.7.1/go.mod h1:XS+EMzW0EmjL/aioQsvLIYJRtC7/lodai5l8SNmlYIs= +github.com/uber/h3-go/v4 v4.3.0 h1:5y5je8gu6+1pGzGo8soiudmgE3WJzfJRWdy0yhc3+HY= +github.com/uber/h3-go/v4 v4.3.0/go.mod h1:EyZ/EWguHlheIBcshTAMmQPYcaGKVvJ4qlzEHzC0BkU= github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 h1:mJdDDPblDfPe7z7go8Dvv1AJQDI3eQ/5xith3q2mFlo= github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07/go.mod h1:Ak17IJ037caFp4jpCw/iQQ7/W74Sqpb1YuKJU6HTKfM= github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= diff --git a/h3.go b/h3.go index 38c6c4a3..4f96be13 100644 --- a/h3.go +++ b/h3.go @@ -5,21 +5,30 @@ import ( "github.com/Gleipnir-Technology/go-geojson2h3" "github.com/tidwall/geojson" - "github.com/uber/h3-go/v3" + "github.com/uber/h3-go/v4" ) -func h3Indexes() []h3.H3Index { +func h3Indexes() []h3.Cell { //[] uint64{0x852a134ffffffff}) /*result := make([]h3.H3Index, 0) for _, v := range values { result = append(result, v) } return result*/ - return []h3.H3Index{ - 0x852a134ffffffff, + return []h3.Cell{ + 0x8629aab2fffffff, + 0x8629a8627ffffff, + 0x8629a8607ffffff, + 0x8629a8717ffffff, + 0x8629a8617ffffff, + 0x8629a8407ffffff, + 0x8629a871fffffff, + 0x8629a845fffffff, + 0x8629aab27ffffff, + 0x8629a84e7ffffff, } } -func h3ToGeoJSON(indexes []h3.H3Index) (string, error) { +func h3ToGeoJSON(indexes []h3.Cell) (string, error) { featureCollection, err := geojson2h3.ToFeatureCollection(indexes) if err != nil { return "", fmt.Errorf("Failed to get feature collection: %w", err) @@ -38,7 +47,7 @@ func main2() { panic(err) } for _, index := range indexes { - fmt.Printf("h3index: %s\n", h3.ToString(index)) + fmt.Printf("h3index: %s\n", index.String()) } featureCollection, err := geojson2h3.ToFeatureCollection(indexes) @@ -48,3 +57,25 @@ func main2() { fmt.Println("Polyfill:") fmt.Println(featureCollection.JSON()) } + +// Given a cell at a smaller resolution remap it to the larger resolution +func scaleCell(cell h3.Cell, resolution int) (h3.Cell, error) { + r := cell.Resolution() + if r == resolution { + return cell, nil + } + latLong, err := cell.LatLng() + if err != nil { + return 0, fmt.Errorf("Failed to get latlng: %w", err) + } + scaled, err := h3.LatLngToCell(latLong, resolution) + if err != nil { + return 0, fmt.Errorf("Failed to create latlng: %w", err) + } + return scaled, nil +} + +func getCell(x, y float64, resolution int) (h3.Cell, error) { + latLng := h3.NewLatLng(y, x) + return h3.LatLngToCell(latLng, resolution) +} diff --git a/migrations/00013_fs_globalid_not_null.sql b/migrations/00013_fs_globalid_not_null.sql new file mode 100644 index 00000000..d04d1f76 --- /dev/null +++ b/migrations/00013_fs_globalid_not_null.sql @@ -0,0 +1,73 @@ +-- +goose Up +ALTER TABLE fs_containerrelate ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_fieldscoutinglog ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_habitatrelate ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_habitatrelate ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_inspectionsample ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_inspectionsample ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_inspectionsampledetail ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_linelocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_locationtracking ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_mosquitoinspection ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_mosquitoinspection ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN geometry_x SET NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN geometry_y SET NOT NULL; +ALTER TABLE fs_polygonlocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_polygonlocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_pool ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_pooldetail ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_proposedtreatmentarea ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_qamosquitoinspection ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_rodentlocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_samplecollection ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_samplelocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN geometry_x SET NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN geometry_y SET NOT NULL; +ALTER TABLE fs_speciesabundance ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_stormdrain ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_timecard ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_trapdata ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_traplocation ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_treatment ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_treatmentarea ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_zones ALTER COLUMN globalid SET NOT NULL; +ALTER TABLE fs_zones2 ALTER COLUMN globalid SET NOT NULL; + +-- +goose Down +ALTER TABLE fs_containerrelate ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_fieldscoutinglog ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_habitatrelate ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_habitatrelate ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_inspectionsample ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_inspectionsample ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_inspectionsampledetail ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_linelocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_locationtracking ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_mosquitoinspection ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_mosquitoinspection ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN geometry_y DROP NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN geometry_x DROP NOT NULL; +ALTER TABLE fs_pointlocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_polygonlocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_polygonlocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_pool ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_pooldetail ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_proposedtreatmentarea ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_qamosquitoinspection ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_rodentlocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_samplecollection ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_samplelocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN geometry_y DROP NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN geometry_x DROP NOT NULL; +ALTER TABLE fs_servicerequest ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_speciesabundance ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_stormdrain ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_timecard ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_trapdata ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_traplocation ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_treatment ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_treatmentarea ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_zones ALTER COLUMN globalid DROP NOT NULL; +ALTER TABLE fs_zones2 ALTER COLUMN globalid DROP NOT NULL; diff --git a/migrations/00014_h3_aggregation.sql b/migrations/00014_h3_aggregation.sql new file mode 100644 index 00000000..3e197c97 --- /dev/null +++ b/migrations/00014_h3_aggregation.sql @@ -0,0 +1,20 @@ +-- +goose Up +-- CREATE EXTENSION h3; +-- CREATE EXTENSION h3_postgis CASCADE; +CREATE TYPE H3AggregationType AS ENUM ( + 'MosquitoSource', + 'ServiceRequest'); + +CREATE TABLE h3_aggregation ( + id SERIAL PRIMARY KEY, + cell h3index NOT NULL, + resolution INT NOT NULL, + count_ INTEGER NOT NULL, + type_ H3AggregationType NOT NULL, + organization_id INTEGER REFERENCES organization (id) NOT NULL, + UNIQUE(cell, organization_id, type_)); + +-- +goose Down +DROP TABLE h3_aggregation; +DROP TYPE H3AggregationType; +-- DROP EXTENSION h3; diff --git a/models/bob_joins.bob.go b/models/bob_joins.bob.go index f639286e..52918376 100644 --- a/models/bob_joins.bob.go +++ b/models/bob_joins.bob.go @@ -60,6 +60,7 @@ type joins[Q dialect.Joinable] struct { FSTreatmentareas joinSet[fsTreatmentareaJoins[Q]] FSZones joinSet[fsZoneJoins[Q]] FSZones2s joinSet[fsZones2Joins[Q]] + H3Aggregations joinSet[h3AggregationJoins[Q]] HistoryContainerrelates joinSet[historyContainerrelateJoins[Q]] HistoryFieldscoutinglogs joinSet[historyFieldscoutinglogJoins[Q]] HistoryHabitatrelates joinSet[historyHabitatrelateJoins[Q]] @@ -131,6 +132,7 @@ func getJoins[Q dialect.Joinable]() joins[Q] { FSTreatmentareas: buildJoinSet[fsTreatmentareaJoins[Q]](FSTreatmentareas.Columns, buildFSTreatmentareaJoins), FSZones: buildJoinSet[fsZoneJoins[Q]](FSZones.Columns, buildFSZoneJoins), FSZones2s: buildJoinSet[fsZones2Joins[Q]](FSZones2s.Columns, buildFSZones2Joins), + H3Aggregations: buildJoinSet[h3AggregationJoins[Q]](H3Aggregations.Columns, buildH3AggregationJoins), HistoryContainerrelates: buildJoinSet[historyContainerrelateJoins[Q]](HistoryContainerrelates.Columns, buildHistoryContainerrelateJoins), HistoryFieldscoutinglogs: buildJoinSet[historyFieldscoutinglogJoins[Q]](HistoryFieldscoutinglogs.Columns, buildHistoryFieldscoutinglogJoins), HistoryHabitatrelates: buildJoinSet[historyHabitatrelateJoins[Q]](HistoryHabitatrelates.Columns, buildHistoryHabitatrelateJoins), diff --git a/models/bob_loaders.bob.go b/models/bob_loaders.bob.go index 3441ba56..7710b5b1 100644 --- a/models/bob_loaders.bob.go +++ b/models/bob_loaders.bob.go @@ -45,6 +45,7 @@ type preloaders struct { FSTreatmentarea fsTreatmentareaPreloader FSZone fsZonePreloader FSZones2 fsZones2Preloader + H3Aggregation h3AggregationPreloader HistoryContainerrelate historyContainerrelatePreloader HistoryFieldscoutinglog historyFieldscoutinglogPreloader HistoryHabitatrelate historyHabitatrelatePreloader @@ -108,6 +109,7 @@ func getPreloaders() preloaders { FSTreatmentarea: buildFSTreatmentareaPreloader(), FSZone: buildFSZonePreloader(), FSZones2: buildFSZones2Preloader(), + H3Aggregation: buildH3AggregationPreloader(), HistoryContainerrelate: buildHistoryContainerrelatePreloader(), HistoryFieldscoutinglog: buildHistoryFieldscoutinglogPreloader(), HistoryHabitatrelate: buildHistoryHabitatrelatePreloader(), @@ -177,6 +179,7 @@ type thenLoaders[Q orm.Loadable] struct { FSTreatmentarea fsTreatmentareaThenLoader[Q] FSZone fsZoneThenLoader[Q] FSZones2 fsZones2ThenLoader[Q] + H3Aggregation h3AggregationThenLoader[Q] HistoryContainerrelate historyContainerrelateThenLoader[Q] HistoryFieldscoutinglog historyFieldscoutinglogThenLoader[Q] HistoryHabitatrelate historyHabitatrelateThenLoader[Q] @@ -240,6 +243,7 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { FSTreatmentarea: buildFSTreatmentareaThenLoader[Q](), FSZone: buildFSZoneThenLoader[Q](), FSZones2: buildFSZones2ThenLoader[Q](), + H3Aggregation: buildH3AggregationThenLoader[Q](), HistoryContainerrelate: buildHistoryContainerrelateThenLoader[Q](), HistoryFieldscoutinglog: buildHistoryFieldscoutinglogThenLoader[Q](), HistoryHabitatrelate: buildHistoryHabitatrelateThenLoader[Q](), diff --git a/models/bob_types.bob_test.go b/models/bob_types.bob_test.go index 2c853e3e..97fc5c43 100644 --- a/models/bob_types.bob_test.go +++ b/models/bob_types.bob_test.go @@ -8,6 +8,7 @@ import ( "database/sql/driver" enums "github.com/Gleipnir-Technology/nidus-sync/enums" + "github.com/lib/pq" "github.com/stephenafamo/bob" ) @@ -98,9 +99,18 @@ var _ bob.HookableType = &FSZone{} // Make sure the type FSZones2 runs hooks after queries var _ bob.HookableType = &FSZones2{} +// Make sure the type GeographyColumn runs hooks after queries +var _ bob.HookableType = &GeographyColumn{} + +// Make sure the type GeometryColumn runs hooks after queries +var _ bob.HookableType = &GeometryColumn{} + // Make sure the type GooseDBVersion runs hooks after queries var _ bob.HookableType = &GooseDBVersion{} +// Make sure the type H3Aggregation runs hooks after queries +var _ bob.HookableType = &H3Aggregation{} + // Make sure the type HistoryContainerrelate runs hooks after queries var _ bob.HookableType = &HistoryContainerrelate{} @@ -191,18 +201,51 @@ var _ bob.HookableType = &OauthToken{} // Make sure the type Organization runs hooks after queries var _ bob.HookableType = &Organization{} +// Make sure the type RasterColumn runs hooks after queries +var _ bob.HookableType = &RasterColumn{} + +// Make sure the type RasterOverview runs hooks after queries +var _ bob.HookableType = &RasterOverview{} + // Make sure the type Session runs hooks after queries var _ bob.HookableType = &Session{} +// Make sure the type SpatialRefSy runs hooks after queries +var _ bob.HookableType = &SpatialRefSy{} + // Make sure the type User runs hooks after queries var _ bob.HookableType = &User{} +// Make sure the type enums.H3aggregationtype satisfies database/sql.Scanner +var _ sql.Scanner = (*enums.H3aggregationtype)(nil) + +// Make sure the type enums.H3aggregationtype satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(enums.H3aggregationtype) + // Make sure the type enums.Notificationtype satisfies database/sql.Scanner var _ sql.Scanner = (*enums.Notificationtype)(nil) // Make sure the type enums.Notificationtype satisfies database/sql/driver.Valuer var _ driver.Valuer = *new(enums.Notificationtype) +// Make sure the type pq.StringArray satisfies database/sql.Scanner +var _ sql.Scanner = (*pq.StringArray)(nil) + +// Make sure the type pq.StringArray satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(pq.StringArray) + +// Make sure the type pq.Float64Array satisfies database/sql.Scanner +var _ sql.Scanner = (*pq.Float64Array)(nil) + +// Make sure the type pq.Float64Array satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(pq.Float64Array) + +// Make sure the type pq.BoolArray satisfies database/sql.Scanner +var _ sql.Scanner = (*pq.BoolArray)(nil) + +// Make sure the type pq.BoolArray satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(pq.BoolArray) + // Make sure the type enums.Arcgislicensetype satisfies database/sql.Scanner var _ sql.Scanner = (*enums.Arcgislicensetype)(nil) diff --git a/models/bob_where.bob.go b/models/bob_where.bob.go index d6517dcd..626a664b 100644 --- a/models/bob_where.bob.go +++ b/models/bob_where.bob.go @@ -45,7 +45,10 @@ func Where[Q psql.Filterable]() struct { FSTreatmentareas fsTreatmentareaWhere[Q] FSZones fsZoneWhere[Q] FSZones2s fsZones2Where[Q] + GeographyColumns geographyColumnWhere[Q] + GeometryColumns geometryColumnWhere[Q] GooseDBVersions gooseDBVersionWhere[Q] + H3Aggregations h3AggregationWhere[Q] HistoryContainerrelates historyContainerrelateWhere[Q] HistoryFieldscoutinglogs historyFieldscoutinglogWhere[Q] HistoryHabitatrelates historyHabitatrelateWhere[Q] @@ -76,7 +79,10 @@ func Where[Q psql.Filterable]() struct { Notifications notificationWhere[Q] OauthTokens oauthTokenWhere[Q] Organizations organizationWhere[Q] + RasterColumns rasterColumnWhere[Q] + RasterOverviews rasterOverviewWhere[Q] Sessions sessionWhere[Q] + SpatialRefSys spatialRefSyWhere[Q] Users userWhere[Q] } { return struct { @@ -108,7 +114,10 @@ func Where[Q psql.Filterable]() struct { FSTreatmentareas fsTreatmentareaWhere[Q] FSZones fsZoneWhere[Q] FSZones2s fsZones2Where[Q] + GeographyColumns geographyColumnWhere[Q] + GeometryColumns geometryColumnWhere[Q] GooseDBVersions gooseDBVersionWhere[Q] + H3Aggregations h3AggregationWhere[Q] HistoryContainerrelates historyContainerrelateWhere[Q] HistoryFieldscoutinglogs historyFieldscoutinglogWhere[Q] HistoryHabitatrelates historyHabitatrelateWhere[Q] @@ -139,7 +148,10 @@ func Where[Q psql.Filterable]() struct { Notifications notificationWhere[Q] OauthTokens oauthTokenWhere[Q] Organizations organizationWhere[Q] + RasterColumns rasterColumnWhere[Q] + RasterOverviews rasterOverviewWhere[Q] Sessions sessionWhere[Q] + SpatialRefSys spatialRefSyWhere[Q] Users userWhere[Q] }{ FieldseekerSyncs: buildFieldseekerSyncWhere[Q](FieldseekerSyncs.Columns), @@ -170,7 +182,10 @@ func Where[Q psql.Filterable]() struct { FSTreatmentareas: buildFSTreatmentareaWhere[Q](FSTreatmentareas.Columns), FSZones: buildFSZoneWhere[Q](FSZones.Columns), FSZones2s: buildFSZones2Where[Q](FSZones2s.Columns), + GeographyColumns: buildGeographyColumnWhere[Q](GeographyColumns.Columns), + GeometryColumns: buildGeometryColumnWhere[Q](GeometryColumns.Columns), GooseDBVersions: buildGooseDBVersionWhere[Q](GooseDBVersions.Columns), + H3Aggregations: buildH3AggregationWhere[Q](H3Aggregations.Columns), HistoryContainerrelates: buildHistoryContainerrelateWhere[Q](HistoryContainerrelates.Columns), HistoryFieldscoutinglogs: buildHistoryFieldscoutinglogWhere[Q](HistoryFieldscoutinglogs.Columns), HistoryHabitatrelates: buildHistoryHabitatrelateWhere[Q](HistoryHabitatrelates.Columns), @@ -201,7 +216,10 @@ func Where[Q psql.Filterable]() struct { Notifications: buildNotificationWhere[Q](Notifications.Columns), OauthTokens: buildOauthTokenWhere[Q](OauthTokens.Columns), Organizations: buildOrganizationWhere[Q](Organizations.Columns), + RasterColumns: buildRasterColumnWhere[Q](RasterColumns.Columns), + RasterOverviews: buildRasterOverviewWhere[Q](RasterOverviews.Columns), Sessions: buildSessionWhere[Q](Sessions.Columns), + SpatialRefSys: buildSpatialRefSyWhere[Q](SpatialRefSys.Columns), Users: buildUserWhere[Q](Users.Columns), } } diff --git a/models/fs_containerrelate.bob.go b/models/fs_containerrelate.bob.go index 79942005..d461cf46 100644 --- a/models/fs_containerrelate.bob.go +++ b/models/fs_containerrelate.bob.go @@ -32,7 +32,7 @@ type FSContainerrelate struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Inspsampleid null.Val[string] `db:"inspsampleid" ` Mosquitoinspid null.Val[string] `db:"mosquitoinspid" ` Objectid int32 `db:"objectid,pk" ` @@ -131,7 +131,7 @@ type FSContainerrelateSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Inspsampleid omitnull.Val[string] `db:"inspsampleid" ` Mosquitoinspid omitnull.Val[string] `db:"mosquitoinspid" ` Objectid omit.Val[int32] `db:"objectid,pk" ` @@ -165,7 +165,7 @@ func (s FSContainerrelateSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Inspsampleid.IsUnset() { @@ -223,8 +223,8 @@ func (s FSContainerrelateSetter) Overwrite(t *FSContainerrelate) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Inspsampleid.IsUnset() { t.Inspsampleid = s.Inspsampleid.MustGetNull() @@ -304,8 +304,8 @@ func (s *FSContainerrelateSetter) Apply(q *dialect.InsertQuery) { vals[5] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[6] = psql.Arg(s.Globalid.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } @@ -429,7 +429,7 @@ func (s FSContainerrelateSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -818,7 +818,7 @@ type fsContainerrelateWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Inspsampleid psql.WhereNullMod[Q, string] Mosquitoinspid psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] @@ -844,7 +844,7 @@ func buildFSContainerrelateWhere[Q psql.Filterable](cols fsContainerrelateColumn Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Inspsampleid: psql.WhereNull[Q, string](cols.Inspsampleid), Mosquitoinspid: psql.WhereNull[Q, string](cols.Mosquitoinspid), Objectid: psql.Where[Q, int32](cols.Objectid), diff --git a/models/fs_fieldscoutinglog.bob.go b/models/fs_fieldscoutinglog.bob.go index 183f1e11..51aa2a7c 100644 --- a/models/fs_fieldscoutinglog.bob.go +++ b/models/fs_fieldscoutinglog.bob.go @@ -31,7 +31,7 @@ type FSFieldscoutinglog struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Objectid int32 `db:"objectid,pk" ` Status null.Val[int16] `db:"status" ` CreatedDate null.Val[int64] `db:"created_date" ` @@ -121,7 +121,7 @@ type FSFieldscoutinglogSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Objectid omit.Val[int32] `db:"objectid,pk" ` Status omitnull.Val[int16] `db:"status" ` CreatedDate omitnull.Val[int64] `db:"created_date" ` @@ -150,7 +150,7 @@ func (s FSFieldscoutinglogSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if s.Objectid.IsValue() { @@ -199,8 +199,8 @@ func (s FSFieldscoutinglogSetter) Overwrite(t *FSFieldscoutinglog) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if s.Objectid.IsValue() { t.Objectid = s.Objectid.MustGet() @@ -268,8 +268,8 @@ func (s *FSFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { vals[4] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[5] = psql.Arg(s.Globalid.MustGet()) } else { vals[5] = psql.Raw("DEFAULT") } @@ -374,7 +374,7 @@ func (s FSFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -748,7 +748,7 @@ type fsFieldscoutinglogWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Objectid psql.WhereMod[Q, int32] Status psql.WhereNullMod[Q, int16] CreatedDate psql.WhereNullMod[Q, int64] @@ -771,7 +771,7 @@ func buildFSFieldscoutinglogWhere[Q psql.Filterable](cols fsFieldscoutinglogColu Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Objectid: psql.Where[Q, int32](cols.Objectid), Status: psql.WhereNull[Q, int16](cols.Status), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), diff --git a/models/fs_habitatrelate.bob.go b/models/fs_habitatrelate.bob.go index a3150c04..ab956ddc 100644 --- a/models/fs_habitatrelate.bob.go +++ b/models/fs_habitatrelate.bob.go @@ -32,7 +32,7 @@ type FSHabitatrelate struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` ForeignID null.Val[string] `db:"foreign_id" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitattype null.Val[string] `db:"habitattype" ` Objectid int32 `db:"objectid,pk" ` CreatedDate null.Val[int64] `db:"created_date" ` @@ -125,7 +125,7 @@ type FSHabitatrelateSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` ForeignID omitnull.Val[string] `db:"foreign_id" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitattype omitnull.Val[string] `db:"habitattype" ` Objectid omit.Val[int32] `db:"objectid,pk" ` CreatedDate omitnull.Val[int64] `db:"created_date" ` @@ -157,7 +157,7 @@ func (s FSHabitatrelateSetter) SetColumns() []string { if !s.ForeignID.IsUnset() { vals = append(vals, "foreign_id") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitattype.IsUnset() { @@ -209,8 +209,8 @@ func (s FSHabitatrelateSetter) Overwrite(t *FSHabitatrelate) { if !s.ForeignID.IsUnset() { t.ForeignID = s.ForeignID.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitattype.IsUnset() { t.Habitattype = s.Habitattype.MustGetNull() @@ -284,8 +284,8 @@ func (s *FSHabitatrelateSetter) Apply(q *dialect.InsertQuery) { vals[5] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[6] = psql.Arg(s.Globalid.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } @@ -397,7 +397,7 @@ func (s FSHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -772,7 +772,7 @@ type fsHabitatrelateWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] ForeignID psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitattype psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] CreatedDate psql.WhereNullMod[Q, int64] @@ -796,7 +796,7 @@ func buildFSHabitatrelateWhere[Q psql.Filterable](cols fsHabitatrelateColumns) f Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), ForeignID: psql.WhereNull[Q, string](cols.ForeignID), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitattype: psql.WhereNull[Q, string](cols.Habitattype), Objectid: psql.Where[Q, int32](cols.Objectid), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), diff --git a/models/fs_inspectionsample.bob.go b/models/fs_inspectionsample.bob.go index 57635929..27b0181c 100644 --- a/models/fs_inspectionsample.bob.go +++ b/models/fs_inspectionsample.bob.go @@ -31,7 +31,7 @@ type FSInspectionsample struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Idbytech null.Val[string] `db:"idbytech" ` InspID null.Val[string] `db:"insp_id" ` Objectid int32 `db:"objectid,pk" ` @@ -130,7 +130,7 @@ type FSInspectionsampleSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Idbytech omitnull.Val[string] `db:"idbytech" ` InspID omitnull.Val[string] `db:"insp_id" ` Objectid omit.Val[int32] `db:"objectid,pk" ` @@ -162,7 +162,7 @@ func (s FSInspectionsampleSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Idbytech.IsUnset() { @@ -220,8 +220,8 @@ func (s FSInspectionsampleSetter) Overwrite(t *FSInspectionsample) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Idbytech.IsUnset() { t.Idbytech = s.Idbytech.MustGetNull() @@ -298,8 +298,8 @@ func (s *FSInspectionsampleSetter) Apply(q *dialect.InsertQuery) { vals[4] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[5] = psql.Arg(s.Globalid.MustGet()) } else { vals[5] = psql.Raw("DEFAULT") } @@ -422,7 +422,7 @@ func (s FSInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -817,7 +817,7 @@ type fsInspectionsampleWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Idbytech psql.WhereNullMod[Q, string] InspID psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] @@ -843,7 +843,7 @@ func buildFSInspectionsampleWhere[Q psql.Filterable](cols fsInspectionsampleColu Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Idbytech: psql.WhereNull[Q, string](cols.Idbytech), InspID: psql.WhereNull[Q, string](cols.InspID), Objectid: psql.Where[Q, int32](cols.Objectid), diff --git a/models/fs_inspectionsampledetail.bob.go b/models/fs_inspectionsampledetail.bob.go index 13855029..9dd08173 100644 --- a/models/fs_inspectionsampledetail.bob.go +++ b/models/fs_inspectionsampledetail.bob.go @@ -39,7 +39,7 @@ type FSInspectionsampledetail struct { Flarvcount null.Val[int16] `db:"flarvcount" ` Flstages null.Val[string] `db:"flstages" ` Fpupcount null.Val[int16] `db:"fpupcount" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` InspsampleID null.Val[string] `db:"inspsample_id" ` Labspecies null.Val[string] `db:"labspecies" ` Ldomstage null.Val[string] `db:"ldomstage" ` @@ -171,7 +171,7 @@ type FSInspectionsampledetailSetter struct { Flarvcount omitnull.Val[int16] `db:"flarvcount" ` Flstages omitnull.Val[string] `db:"flstages" ` Fpupcount omitnull.Val[int16] `db:"fpupcount" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` InspsampleID omitnull.Val[string] `db:"inspsample_id" ` Labspecies omitnull.Val[string] `db:"labspecies" ` Ldomstage omitnull.Val[string] `db:"ldomstage" ` @@ -230,7 +230,7 @@ func (s FSInspectionsampledetailSetter) SetColumns() []string { if !s.Fpupcount.IsUnset() { vals = append(vals, "fpupcount") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.InspsampleID.IsUnset() { @@ -321,8 +321,8 @@ func (s FSInspectionsampledetailSetter) Overwrite(t *FSInspectionsampledetail) { if !s.Fpupcount.IsUnset() { t.Fpupcount = s.Fpupcount.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.InspsampleID.IsUnset() { t.InspsampleID = s.InspsampleID.MustGetNull() @@ -456,8 +456,8 @@ func (s *FSInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { vals[12] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[13] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[13] = psql.Arg(s.Globalid.MustGet()) } else { vals[13] = psql.Raw("DEFAULT") } @@ -654,7 +654,7 @@ func (s FSInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expr }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1078,7 +1078,7 @@ type fsInspectionsampledetailWhere[Q psql.Filterable] struct { Flarvcount psql.WhereNullMod[Q, int16] Flstages psql.WhereNullMod[Q, string] Fpupcount psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] InspsampleID psql.WhereNullMod[Q, string] Labspecies psql.WhereNullMod[Q, string] Ldomstage psql.WhereNullMod[Q, string] @@ -1115,7 +1115,7 @@ func buildFSInspectionsampledetailWhere[Q psql.Filterable](cols fsInspectionsamp Flarvcount: psql.WhereNull[Q, int16](cols.Flarvcount), Flstages: psql.WhereNull[Q, string](cols.Flstages), Fpupcount: psql.WhereNull[Q, int16](cols.Fpupcount), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), InspsampleID: psql.WhereNull[Q, string](cols.InspsampleID), Labspecies: psql.WhereNull[Q, string](cols.Labspecies), Ldomstage: psql.WhereNull[Q, string](cols.Ldomstage), diff --git a/models/fs_linelocation.bob.go b/models/fs_linelocation.bob.go index bb34b53f..1ae076aa 100644 --- a/models/fs_linelocation.bob.go +++ b/models/fs_linelocation.bob.go @@ -37,7 +37,7 @@ type FSLinelocation struct { Externalid null.Val[string] `db:"externalid" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Hectares null.Val[float64] `db:"hectares" ` Jurisdiction null.Val[string] `db:"jurisdiction" ` @@ -238,7 +238,7 @@ type FSLinelocationSetter struct { Externalid omitnull.Val[string] `db:"externalid" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Hectares omitnull.Val[float64] `db:"hectares" ` Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` @@ -316,7 +316,7 @@ func (s FSLinelocationSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -476,8 +476,8 @@ func (s FSLinelocationSetter) Overwrite(t *FSLinelocation) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -674,8 +674,8 @@ func (s *FSLinelocationSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -1008,7 +1008,7 @@ func (s FSLinelocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1605,7 +1605,7 @@ type fsLinelocationWhere[Q psql.Filterable] struct { Externalid psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Hectares psql.WhereNullMod[Q, float64] Jurisdiction psql.WhereNullMod[Q, string] @@ -1665,7 +1665,7 @@ func buildFSLinelocationWhere[Q psql.Filterable](cols fsLinelocationColumns) fsL Externalid: psql.WhereNull[Q, string](cols.Externalid), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Hectares: psql.WhereNull[Q, float64](cols.Hectares), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), diff --git a/models/fs_locationtracking.bob.go b/models/fs_locationtracking.bob.go index 02bc19b2..c85d2c5a 100644 --- a/models/fs_locationtracking.bob.go +++ b/models/fs_locationtracking.bob.go @@ -33,7 +33,7 @@ type FSLocationtracking struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Objectid int32 `db:"objectid,pk" ` CreatedDate null.Val[int64] `db:"created_date" ` CreatedUser null.Val[string] `db:"created_user" ` @@ -126,7 +126,7 @@ type FSLocationtrackingSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Objectid omit.Val[int32] `db:"objectid,pk" ` CreatedDate omitnull.Val[int64] `db:"created_date" ` CreatedUser omitnull.Val[string] `db:"created_user" ` @@ -160,7 +160,7 @@ func (s FSLocationtrackingSetter) SetColumns() []string { if !s.Fieldtech.IsUnset() { vals = append(vals, "fieldtech") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if s.Objectid.IsValue() { @@ -212,8 +212,8 @@ func (s FSLocationtrackingSetter) Overwrite(t *FSLocationtracking) { if !s.Fieldtech.IsUnset() { t.Fieldtech = s.Fieldtech.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if s.Objectid.IsValue() { t.Objectid = s.Objectid.MustGet() @@ -290,8 +290,8 @@ func (s *FSLocationtrackingSetter) Apply(q *dialect.InsertQuery) { vals[6] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[7] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[7] = psql.Arg(s.Globalid.MustGet()) } else { vals[7] = psql.Raw("DEFAULT") } @@ -404,7 +404,7 @@ func (s FSLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -773,7 +773,7 @@ type fsLocationtrackingWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Objectid psql.WhereMod[Q, int32] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] @@ -797,7 +797,7 @@ func buildFSLocationtrackingWhere[Q psql.Filterable](cols fsLocationtrackingColu Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Objectid: psql.Where[Q, int32](cols.Objectid), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), diff --git a/models/fs_mosquitoinspection.bob.go b/models/fs_mosquitoinspection.bob.go index 4ad65076..3676a691 100644 --- a/models/fs_mosquitoinspection.bob.go +++ b/models/fs_mosquitoinspection.bob.go @@ -46,7 +46,7 @@ type FSMosquitoinspection struct { Editor null.Val[string] `db:"editor" ` Fieldspecies null.Val[string] `db:"fieldspecies" ` Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Jurisdiction null.Val[string] `db:"jurisdiction" ` Larvaepresent null.Val[int16] `db:"larvaepresent" ` Linelocid null.Val[string] `db:"linelocid" ` @@ -274,7 +274,7 @@ type FSMosquitoinspectionSetter struct { Editor omitnull.Val[string] `db:"editor" ` Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` Linelocid omitnull.Val[string] `db:"linelocid" ` @@ -379,7 +379,7 @@ func (s FSMosquitoinspectionSetter) SetColumns() []string { if !s.Fieldtech.IsUnset() { vals = append(vals, "fieldtech") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Jurisdiction.IsUnset() { @@ -566,8 +566,8 @@ func (s FSMosquitoinspectionSetter) Overwrite(t *FSMosquitoinspection) { if !s.Fieldtech.IsUnset() { t.Fieldtech = s.Fieldtech.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Jurisdiction.IsUnset() { t.Jurisdiction = s.Jurisdiction.MustGetNull() @@ -818,8 +818,8 @@ func (s *FSMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[19] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[20] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[20] = psql.Arg(s.Globalid.MustGet()) } else { vals[20] = psql.Raw("DEFAULT") } @@ -1215,7 +1215,7 @@ func (s FSMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expressi }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1821,7 +1821,7 @@ type fsMosquitoinspectionWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] Fieldspecies psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] Larvaepresent psql.WhereNullMod[Q, int16] Linelocid psql.WhereNullMod[Q, string] @@ -1890,7 +1890,7 @@ func buildFSMosquitoinspectionWhere[Q psql.Filterable](cols fsMosquitoinspection Editor: psql.WhereNull[Q, string](cols.Editor), Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), Linelocid: psql.WhereNull[Q, string](cols.Linelocid), diff --git a/models/fs_pointlocation.bob.go b/models/fs_pointlocation.bob.go index 5259535d..2b1bfca5 100644 --- a/models/fs_pointlocation.bob.go +++ b/models/fs_pointlocation.bob.go @@ -36,7 +36,7 @@ type FSPointlocation struct { Externalid null.Val[string] `db:"externalid" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Jurisdiction null.Val[string] `db:"jurisdiction" ` Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` @@ -67,8 +67,8 @@ type FSPointlocation struct { Y null.Val[float64] `db:"y" ` Zone null.Val[string] `db:"zone" ` Zone2 null.Val[string] `db:"zone2" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` + GeometryX float64 `db:"geometry_x" ` + GeometryY float64 `db:"geometry_y" ` Assignedtech null.Val[string] `db:"assignedtech" ` DeactivateReason null.Val[string] `db:"deactivate_reason" ` Scalarpriority null.Val[int64] `db:"scalarpriority" ` @@ -225,7 +225,7 @@ type FSPointlocationSetter struct { Externalid omitnull.Val[string] `db:"externalid" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` @@ -256,8 +256,8 @@ type FSPointlocationSetter struct { Y omitnull.Val[float64] `db:"y" ` Zone omitnull.Val[string] `db:"zone" ` Zone2 omitnull.Val[string] `db:"zone2" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` + GeometryX omit.Val[float64] `db:"geometry_x" ` + GeometryY omit.Val[float64] `db:"geometry_y" ` Assignedtech omitnull.Val[string] `db:"assignedtech" ` DeactivateReason omitnull.Val[string] `db:"deactivate_reason" ` Scalarpriority omitnull.Val[int64] `db:"scalarpriority" ` @@ -297,7 +297,7 @@ func (s FSPointlocationSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -390,10 +390,10 @@ func (s FSPointlocationSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } - if !s.GeometryX.IsUnset() { + if s.GeometryX.IsValue() { vals = append(vals, "geometry_x") } - if !s.GeometryY.IsUnset() { + if s.GeometryY.IsValue() { vals = append(vals, "geometry_y") } if !s.Assignedtech.IsUnset() { @@ -445,8 +445,8 @@ func (s FSPointlocationSetter) Overwrite(t *FSPointlocation) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -538,11 +538,11 @@ func (s FSPointlocationSetter) Overwrite(t *FSPointlocation) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() + if s.GeometryX.IsValue() { + t.GeometryX = s.GeometryX.MustGet() } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() + if s.GeometryY.IsValue() { + t.GeometryY = s.GeometryY.MustGet() } if !s.Assignedtech.IsUnset() { t.Assignedtech = s.Assignedtech.MustGetNull() @@ -628,8 +628,8 @@ func (s *FSPointlocationSetter) Apply(q *dialect.InsertQuery) { vals[9] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[10] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[10] = psql.Arg(s.Globalid.MustGet()) } else { vals[10] = psql.Raw("DEFAULT") } @@ -814,14 +814,14 @@ func (s *FSPointlocationSetter) Apply(q *dialect.InsertQuery) { vals[40] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[41] = psql.Arg(s.GeometryX.MustGetNull()) + if s.GeometryX.IsValue() { + vals[41] = psql.Arg(s.GeometryX.MustGet()) } else { vals[41] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[42] = psql.Arg(s.GeometryY.MustGetNull()) + if s.GeometryY.IsValue() { + vals[42] = psql.Arg(s.GeometryY.MustGet()) } else { vals[42] = psql.Raw("DEFAULT") } @@ -937,7 +937,7 @@ func (s FSPointlocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1154,14 +1154,14 @@ func (s FSPointlocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.GeometryX.IsUnset() { + if s.GeometryX.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "geometry_x")...), psql.Arg(s.GeometryX), }}) } - if !s.GeometryY.IsUnset() { + if s.GeometryY.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "geometry_y")...), psql.Arg(s.GeometryY), @@ -1512,7 +1512,7 @@ type fsPointlocationWhere[Q psql.Filterable] struct { Externalid psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] Larvinspectinterval psql.WhereNullMod[Q, int16] @@ -1543,8 +1543,8 @@ type fsPointlocationWhere[Q psql.Filterable] struct { Y psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] + GeometryX psql.WhereMod[Q, float64] + GeometryY psql.WhereMod[Q, float64] Assignedtech psql.WhereNullMod[Q, string] DeactivateReason psql.WhereNullMod[Q, string] Scalarpriority psql.WhereNullMod[Q, int64] @@ -1568,7 +1568,7 @@ func buildFSPointlocationWhere[Q psql.Filterable](cols fsPointlocationColumns) f Externalid: psql.WhereNull[Q, string](cols.Externalid), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), @@ -1599,8 +1599,8 @@ func buildFSPointlocationWhere[Q psql.Filterable](cols fsPointlocationColumns) f Y: psql.WhereNull[Q, float64](cols.Y), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), - GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), - GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + GeometryX: psql.Where[Q, float64](cols.GeometryX), + GeometryY: psql.Where[Q, float64](cols.GeometryY), Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), DeactivateReason: psql.WhereNull[Q, string](cols.DeactivateReason), Scalarpriority: psql.WhereNull[Q, int64](cols.Scalarpriority), diff --git a/models/fs_polygonlocation.bob.go b/models/fs_polygonlocation.bob.go index 3af7e32c..e6ab4f43 100644 --- a/models/fs_polygonlocation.bob.go +++ b/models/fs_polygonlocation.bob.go @@ -38,7 +38,7 @@ type FSPolygonlocation struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Filter null.Val[string] `db:"filter" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Hectares null.Val[float64] `db:"hectares" ` Jurisdiction null.Val[string] `db:"jurisdiction" ` @@ -221,7 +221,7 @@ type FSPolygonlocationSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Filter omitnull.Val[string] `db:"filter" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Hectares omitnull.Val[float64] `db:"hectares" ` Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` @@ -295,7 +295,7 @@ func (s FSPolygonlocationSetter) SetColumns() []string { if !s.Filter.IsUnset() { vals = append(vals, "filter") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -437,8 +437,8 @@ func (s FSPolygonlocationSetter) Overwrite(t *FSPolygonlocation) { if !s.Filter.IsUnset() { t.Filter = s.Filter.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -620,8 +620,8 @@ func (s *FSPolygonlocationSetter) Apply(q *dialect.InsertQuery) { vals[11] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[12] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[12] = psql.Arg(s.Globalid.MustGet()) } else { vals[12] = psql.Raw("DEFAULT") } @@ -919,7 +919,7 @@ func (s FSPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1468,7 +1468,7 @@ type fsPolygonlocationWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Filter psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Hectares psql.WhereNullMod[Q, float64] Jurisdiction psql.WhereNullMod[Q, string] @@ -1522,7 +1522,7 @@ func buildFSPolygonlocationWhere[Q psql.Filterable](cols fsPolygonlocationColumn Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Filter: psql.WhereNull[Q, string](cols.Filter), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Hectares: psql.WhereNull[Q, float64](cols.Hectares), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), diff --git a/models/fs_pool.bob.go b/models/fs_pool.bob.go index 408d4693..969538d9 100644 --- a/models/fs_pool.bob.go +++ b/models/fs_pool.bob.go @@ -37,7 +37,7 @@ type FSPool struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Lab null.Val[string] `db:"lab" ` LabID null.Val[string] `db:"lab_id" ` Objectid int32 `db:"objectid,pk" ` @@ -178,7 +178,7 @@ type FSPoolSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Lab omitnull.Val[string] `db:"lab" ` LabID omitnull.Val[string] `db:"lab_id" ` Objectid omit.Val[int32] `db:"objectid,pk" ` @@ -236,7 +236,7 @@ func (s FSPoolSetter) SetColumns() []string { if !s.Gatewaysync.IsUnset() { vals = append(vals, "gatewaysync") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Lab.IsUnset() { @@ -336,8 +336,8 @@ func (s FSPoolSetter) Overwrite(t *FSPool) { if !s.Gatewaysync.IsUnset() { t.Gatewaysync = s.Gatewaysync.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Lab.IsUnset() { t.Lab = s.Lab.MustGetNull() @@ -474,8 +474,8 @@ func (s *FSPoolSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -688,7 +688,7 @@ func (s FSPoolSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1145,7 +1145,7 @@ type fsPoolWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Lab psql.WhereNullMod[Q, string] LabID psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] @@ -1185,7 +1185,7 @@ func buildFSPoolWhere[Q psql.Filterable](cols fsPoolColumns) fsPoolWhere[Q] { Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Lab: psql.WhereNull[Q, string](cols.Lab), LabID: psql.WhereNull[Q, string](cols.LabID), Objectid: psql.Where[Q, int32](cols.Objectid), diff --git a/models/fs_pooldetail.bob.go b/models/fs_pooldetail.bob.go index fbadf664..b41a3f6a 100644 --- a/models/fs_pooldetail.bob.go +++ b/models/fs_pooldetail.bob.go @@ -32,7 +32,7 @@ type FSPooldetail struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Females null.Val[int16] `db:"females" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Objectid int32 `db:"objectid,pk" ` PoolID null.Val[string] `db:"pool_id" ` Species null.Val[string] `db:"species" ` @@ -131,7 +131,7 @@ type FSPooldetailSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Females omitnull.Val[int16] `db:"females" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Objectid omit.Val[int32] `db:"objectid,pk" ` PoolID omitnull.Val[string] `db:"pool_id" ` Species omitnull.Val[string] `db:"species" ` @@ -165,7 +165,7 @@ func (s FSPooldetailSetter) SetColumns() []string { if !s.Females.IsUnset() { vals = append(vals, "females") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if s.Objectid.IsValue() { @@ -223,8 +223,8 @@ func (s FSPooldetailSetter) Overwrite(t *FSPooldetail) { if !s.Females.IsUnset() { t.Females = s.Females.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if s.Objectid.IsValue() { t.Objectid = s.Objectid.MustGet() @@ -304,8 +304,8 @@ func (s *FSPooldetailSetter) Apply(q *dialect.InsertQuery) { vals[5] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[6] = psql.Arg(s.Globalid.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } @@ -429,7 +429,7 @@ func (s FSPooldetailSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -818,7 +818,7 @@ type fsPooldetailWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Females psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Objectid psql.WhereMod[Q, int32] PoolID psql.WhereNullMod[Q, string] Species psql.WhereNullMod[Q, string] @@ -844,7 +844,7 @@ func buildFSPooldetailWhere[Q psql.Filterable](cols fsPooldetailColumns) fsPoold Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Females: psql.WhereNull[Q, int16](cols.Females), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Objectid: psql.Where[Q, int32](cols.Objectid), PoolID: psql.WhereNull[Q, string](cols.PoolID), Species: psql.WhereNull[Q, string](cols.Species), diff --git a/models/fs_proposedtreatmentarea.bob.go b/models/fs_proposedtreatmentarea.bob.go index dacf3d55..1614f14f 100644 --- a/models/fs_proposedtreatmentarea.bob.go +++ b/models/fs_proposedtreatmentarea.bob.go @@ -38,7 +38,7 @@ type FSProposedtreatmentarea struct { Exported null.Val[int16] `db:"exported" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Hectares null.Val[float64] `db:"hectares" ` Issprayroute null.Val[int16] `db:"issprayroute" ` Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` @@ -194,7 +194,7 @@ type FSProposedtreatmentareaSetter struct { Exported omitnull.Val[int16] `db:"exported" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Hectares omitnull.Val[float64] `db:"hectares" ` Issprayroute omitnull.Val[int16] `db:"issprayroute" ` Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` @@ -259,7 +259,7 @@ func (s FSProposedtreatmentareaSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Hectares.IsUnset() { @@ -374,8 +374,8 @@ func (s FSProposedtreatmentareaSetter) Overwrite(t *FSProposedtreatmentarea) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Hectares.IsUnset() { t.Hectares = s.Hectares.MustGetNull() @@ -530,8 +530,8 @@ func (s *FSProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { vals[11] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[12] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[12] = psql.Arg(s.Globalid.MustGet()) } else { vals[12] = psql.Raw("DEFAULT") } @@ -775,7 +775,7 @@ func (s FSProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expre }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1261,7 +1261,7 @@ type fsProposedtreatmentareaWhere[Q psql.Filterable] struct { Exported psql.WhereNullMod[Q, int16] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Hectares psql.WhereNullMod[Q, float64] Issprayroute psql.WhereNullMod[Q, int16] Lasttreatactivity psql.WhereNullMod[Q, string] @@ -1306,7 +1306,7 @@ func buildFSProposedtreatmentareaWhere[Q psql.Filterable](cols fsProposedtreatme Exported: psql.WhereNull[Q, int16](cols.Exported), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Hectares: psql.WhereNull[Q, float64](cols.Hectares), Issprayroute: psql.WhereNull[Q, int16](cols.Issprayroute), Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), diff --git a/models/fs_qamosquitoinspection.bob.go b/models/fs_qamosquitoinspection.bob.go index 11f94e0b..bb954659 100644 --- a/models/fs_qamosquitoinspection.bob.go +++ b/models/fs_qamosquitoinspection.bob.go @@ -41,7 +41,7 @@ type FSQamosquitoinspection struct { Editor null.Val[string] `db:"editor" ` Fieldtech null.Val[string] `db:"fieldtech" ` Fish null.Val[int16] `db:"fish" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habvalue1 null.Val[int16] `db:"habvalue1" ` Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` Habvalue2 null.Val[int16] `db:"habvalue2" ` @@ -284,7 +284,7 @@ type FSQamosquitoinspectionSetter struct { Editor omitnull.Val[string] `db:"editor" ` Fieldtech omitnull.Val[string] `db:"fieldtech" ` Fish omitnull.Val[int16] `db:"fish" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` @@ -384,7 +384,7 @@ func (s FSQamosquitoinspectionSetter) SetColumns() []string { if !s.Fish.IsUnset() { vals = append(vals, "fish") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habvalue1.IsUnset() { @@ -586,8 +586,8 @@ func (s FSQamosquitoinspectionSetter) Overwrite(t *FSQamosquitoinspection) { if !s.Fish.IsUnset() { t.Fish = s.Fish.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habvalue1.IsUnset() { t.Habvalue1 = s.Habvalue1.MustGetNull() @@ -838,8 +838,8 @@ func (s *FSQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[14] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[15] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[15] = psql.Arg(s.Globalid.MustGet()) } else { vals[15] = psql.Raw("DEFAULT") } @@ -1260,7 +1260,7 @@ func (s FSQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expres }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1931,7 +1931,7 @@ type fsQamosquitoinspectionWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] Fish psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habvalue1 psql.WhereNullMod[Q, int16] Habvalue1percent psql.WhereNullMod[Q, int16] Habvalue2 psql.WhereNullMod[Q, int16] @@ -2005,7 +2005,7 @@ func buildFSQamosquitoinspectionWhere[Q psql.Filterable](cols fsQamosquitoinspec Editor: psql.WhereNull[Q, string](cols.Editor), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Fish: psql.WhereNull[Q, int16](cols.Fish), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1), Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent), Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2), diff --git a/models/fs_rodentlocation.bob.go b/models/fs_rodentlocation.bob.go index 9ce007cb..048d1875 100644 --- a/models/fs_rodentlocation.bob.go +++ b/models/fs_rodentlocation.bob.go @@ -36,7 +36,7 @@ type FSRodentlocation struct { Externalid null.Val[string] `db:"externalid" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Lastinspectaction null.Val[string] `db:"lastinspectaction" ` Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` @@ -183,7 +183,7 @@ type FSRodentlocationSetter struct { Externalid omitnull.Val[string] `db:"externalid" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` @@ -241,7 +241,7 @@ func (s FSRodentlocationSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -347,8 +347,8 @@ func (s FSRodentlocationSetter) Overwrite(t *FSRodentlocation) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -488,8 +488,8 @@ func (s *FSRodentlocationSetter) Apply(q *dialect.InsertQuery) { vals[9] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[10] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[10] = psql.Arg(s.Globalid.MustGet()) } else { vals[10] = psql.Raw("DEFAULT") } @@ -713,7 +713,7 @@ func (s FSRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1190,7 +1190,7 @@ type fsRodentlocationWhere[Q psql.Filterable] struct { Externalid psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Lastinspectaction psql.WhereNullMod[Q, string] Lastinspectconditions psql.WhereNullMod[Q, string] @@ -1232,7 +1232,7 @@ func buildFSRodentlocationWhere[Q psql.Filterable](cols fsRodentlocationColumns) Externalid: psql.WhereNull[Q, string](cols.Externalid), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Lastinspectaction: psql.WhereNull[Q, string](cols.Lastinspectaction), Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), diff --git a/models/fs_samplecollection.bob.go b/models/fs_samplecollection.bob.go index dfb4e386..1ec61241 100644 --- a/models/fs_samplecollection.bob.go +++ b/models/fs_samplecollection.bob.go @@ -43,7 +43,7 @@ type FSSamplecollection struct { Fieldtech null.Val[string] `db:"fieldtech" ` Flockid null.Val[string] `db:"flockid" ` Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Lab null.Val[string] `db:"lab" ` Locationname null.Val[string] `db:"locationname" ` LocID null.Val[string] `db:"loc_id" ` @@ -238,7 +238,7 @@ type FSSamplecollectionSetter struct { Fieldtech omitnull.Val[string] `db:"fieldtech" ` Flockid omitnull.Val[string] `db:"flockid" ` Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Lab omitnull.Val[string] `db:"lab" ` Locationname omitnull.Val[string] `db:"locationname" ` LocID omitnull.Val[string] `db:"loc_id" ` @@ -326,7 +326,7 @@ func (s FSSamplecollectionSetter) SetColumns() []string { if !s.Gatewaysync.IsUnset() { vals = append(vals, "gatewaysync") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Lab.IsUnset() { @@ -480,8 +480,8 @@ func (s FSSamplecollectionSetter) Overwrite(t *FSSamplecollection) { if !s.Gatewaysync.IsUnset() { t.Gatewaysync = s.Gatewaysync.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Lab.IsUnset() { t.Lab = s.Lab.MustGetNull() @@ -690,8 +690,8 @@ func (s *FSSamplecollectionSetter) Apply(q *dialect.InsertQuery) { vals[16] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[17] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[17] = psql.Arg(s.Globalid.MustGet()) } else { vals[17] = psql.Raw("DEFAULT") } @@ -1018,7 +1018,7 @@ func (s FSSamplecollectionSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1565,7 +1565,7 @@ type fsSamplecollectionWhere[Q psql.Filterable] struct { Fieldtech psql.WhereNullMod[Q, string] Flockid psql.WhereNullMod[Q, string] Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Lab psql.WhereNullMod[Q, string] Locationname psql.WhereNullMod[Q, string] LocID psql.WhereNullMod[Q, string] @@ -1623,7 +1623,7 @@ func buildFSSamplecollectionWhere[Q psql.Filterable](cols fsSamplecollectionColu Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Flockid: psql.WhereNull[Q, string](cols.Flockid), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Lab: psql.WhereNull[Q, string](cols.Lab), Locationname: psql.WhereNull[Q, string](cols.Locationname), LocID: psql.WhereNull[Q, string](cols.LocID), diff --git a/models/fs_samplelocation.bob.go b/models/fs_samplelocation.bob.go index 10b79749..6f6eef8c 100644 --- a/models/fs_samplelocation.bob.go +++ b/models/fs_samplelocation.bob.go @@ -37,7 +37,7 @@ type FSSamplelocation struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Locationnumber null.Val[int64] `db:"locationnumber" ` Name null.Val[string] `db:"name" ` @@ -166,7 +166,7 @@ type FSSamplelocationSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Locationnumber omitnull.Val[int64] `db:"locationnumber" ` Name omitnull.Val[string] `db:"name" ` @@ -220,7 +220,7 @@ func (s FSSamplelocationSetter) SetColumns() []string { if !s.Gatewaysync.IsUnset() { vals = append(vals, "gatewaysync") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -308,8 +308,8 @@ func (s FSSamplelocationSetter) Overwrite(t *FSSamplelocation) { if !s.Gatewaysync.IsUnset() { t.Gatewaysync = s.Gatewaysync.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -434,8 +434,8 @@ func (s *FSSamplelocationSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -624,7 +624,7 @@ func (s FSSamplelocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1053,7 +1053,7 @@ type fsSamplelocationWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Locationnumber psql.WhereNullMod[Q, int64] Name psql.WhereNullMod[Q, string] @@ -1089,7 +1089,7 @@ func buildFSSamplelocationWhere[Q psql.Filterable](cols fsSamplelocationColumns) Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), Name: psql.WhereNull[Q, string](cols.Name), diff --git a/models/fs_servicerequest.bob.go b/models/fs_servicerequest.bob.go index fbb63430..d045fb71 100644 --- a/models/fs_servicerequest.bob.go +++ b/models/fs_servicerequest.bob.go @@ -26,96 +26,96 @@ import ( // FSServicerequest is an object representing the database table. type FSServicerequest struct { - OrganizationID int32 `db:"organization_id" ` - Accepted null.Val[int16] `db:"accepted" ` - Acceptedby null.Val[string] `db:"acceptedby" ` - Accepteddate null.Val[int64] `db:"accepteddate" ` - Allowed null.Val[string] `db:"allowed" ` - Assignedtech null.Val[string] `db:"assignedtech" ` - Clraddr1 null.Val[string] `db:"clraddr1" ` - Clraddr2 null.Val[string] `db:"clraddr2" ` - Clranon null.Val[int16] `db:"clranon" ` - Clrcity null.Val[string] `db:"clrcity" ` - Clrcompany null.Val[string] `db:"clrcompany" ` - Clrcontpref null.Val[string] `db:"clrcontpref" ` - Clremail null.Val[string] `db:"clremail" ` - Clrfname null.Val[string] `db:"clrfname" ` - Clrother null.Val[string] `db:"clrother" ` - Clrphone1 null.Val[string] `db:"clrphone1" ` - Clrphone2 null.Val[string] `db:"clrphone2" ` - Clrstate null.Val[string] `db:"clrstate" ` - Clrzip null.Val[string] `db:"clrzip" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datetimeclosed null.Val[int64] `db:"datetimeclosed" ` - Duedate null.Val[int64] `db:"duedate" ` - Entrytech null.Val[string] `db:"entrytech" ` - Estcompletedate null.Val[int64] `db:"estcompletedate" ` - Externalerror null.Val[string] `db:"externalerror" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Firstresponsedate null.Val[int64] `db:"firstresponsedate" ` - Globalid null.Val[string] `db:"globalid" ` - Issuesreported null.Val[string] `db:"issuesreported" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Nextaction null.Val[string] `db:"nextaction" ` - Notificationtimestamp null.Val[string] `db:"notificationtimestamp" ` - Notified null.Val[int16] `db:"notified" ` - Notifieddate null.Val[int64] `db:"notifieddate" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Priority null.Val[string] `db:"priority" ` - Recdatetime null.Val[int64] `db:"recdatetime" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Rejectedby null.Val[string] `db:"rejectedby" ` - Rejecteddate null.Val[int64] `db:"rejecteddate" ` - Rejectedreason null.Val[string] `db:"rejectedreason" ` - Reqaddr1 null.Val[string] `db:"reqaddr1" ` - Reqaddr2 null.Val[string] `db:"reqaddr2" ` - Reqcity null.Val[string] `db:"reqcity" ` - Reqcompany null.Val[string] `db:"reqcompany" ` - Reqcrossst null.Val[string] `db:"reqcrossst" ` - Reqdescr null.Val[string] `db:"reqdescr" ` - Reqfldnotes null.Val[string] `db:"reqfldnotes" ` - Reqmapgrid null.Val[string] `db:"reqmapgrid" ` - Reqnotesforcust null.Val[string] `db:"reqnotesforcust" ` - Reqnotesfortech null.Val[string] `db:"reqnotesfortech" ` - Reqpermission null.Val[int16] `db:"reqpermission" ` - Reqprogramactions null.Val[string] `db:"reqprogramactions" ` - Reqstate null.Val[string] `db:"reqstate" ` - Reqsubdiv null.Val[string] `db:"reqsubdiv" ` - Reqtarget null.Val[string] `db:"reqtarget" ` - Reqzip null.Val[string] `db:"reqzip" ` - Responsedaycount null.Val[int16] `db:"responsedaycount" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Scheduled null.Val[int16] `db:"scheduled" ` - Scheduleddate null.Val[int64] `db:"scheduleddate" ` - Source null.Val[string] `db:"source" ` - SRNumber null.Val[int64] `db:"sr_number" ` - Status null.Val[string] `db:"status" ` - Supervisor null.Val[string] `db:"supervisor" ` - Techclosed null.Val[string] `db:"techclosed" ` - Validx null.Val[string] `db:"validx" ` - Validy null.Val[string] `db:"validy" ` - Xvalue null.Val[string] `db:"xvalue" ` - Yvalue null.Val[string] `db:"yvalue" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Dog null.Val[int64] `db:"dog" ` - Spanish null.Val[int64] `db:"spanish" ` - ScheduleNotes null.Val[string] `db:"schedule_notes" ` - SchedulePeriod null.Val[string] `db:"schedule_period" ` - Updated time.Time `db:"updated" ` + OrganizationID int32 `db:"organization_id" ` + Accepted null.Val[int16] `db:"accepted" ` + Acceptedby null.Val[string] `db:"acceptedby" ` + Accepteddate null.Val[int64] `db:"accepteddate" ` + Allowed null.Val[string] `db:"allowed" ` + Assignedtech null.Val[string] `db:"assignedtech" ` + Clraddr1 null.Val[string] `db:"clraddr1" ` + Clraddr2 null.Val[string] `db:"clraddr2" ` + Clranon null.Val[int16] `db:"clranon" ` + Clrcity null.Val[string] `db:"clrcity" ` + Clrcompany null.Val[string] `db:"clrcompany" ` + Clrcontpref null.Val[string] `db:"clrcontpref" ` + Clremail null.Val[string] `db:"clremail" ` + Clrfname null.Val[string] `db:"clrfname" ` + Clrother null.Val[string] `db:"clrother" ` + Clrphone1 null.Val[string] `db:"clrphone1" ` + Clrphone2 null.Val[string] `db:"clrphone2" ` + Clrstate null.Val[string] `db:"clrstate" ` + Clrzip null.Val[string] `db:"clrzip" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Datetimeclosed null.Val[int64] `db:"datetimeclosed" ` + Duedate null.Val[int64] `db:"duedate" ` + Entrytech null.Val[string] `db:"entrytech" ` + Estcompletedate null.Val[int64] `db:"estcompletedate" ` + Externalerror null.Val[string] `db:"externalerror" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Firstresponsedate null.Val[int64] `db:"firstresponsedate" ` + Globalid string `db:"globalid" ` + Issuesreported null.Val[string] `db:"issuesreported" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Nextaction null.Val[string] `db:"nextaction" ` + Notificationtimestamp null.Val[string] `db:"notificationtimestamp" ` + Notified null.Val[int16] `db:"notified" ` + Notifieddate null.Val[int64] `db:"notifieddate" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Priority null.Val[string] `db:"priority" ` + Recdatetime null.Val[int64] `db:"recdatetime" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Rejectedby null.Val[string] `db:"rejectedby" ` + Rejecteddate null.Val[int64] `db:"rejecteddate" ` + Rejectedreason null.Val[string] `db:"rejectedreason" ` + Reqaddr1 null.Val[string] `db:"reqaddr1" ` + Reqaddr2 null.Val[string] `db:"reqaddr2" ` + Reqcity null.Val[string] `db:"reqcity" ` + Reqcompany null.Val[string] `db:"reqcompany" ` + Reqcrossst null.Val[string] `db:"reqcrossst" ` + Reqdescr null.Val[string] `db:"reqdescr" ` + Reqfldnotes null.Val[string] `db:"reqfldnotes" ` + Reqmapgrid null.Val[string] `db:"reqmapgrid" ` + Reqnotesforcust null.Val[string] `db:"reqnotesforcust" ` + Reqnotesfortech null.Val[string] `db:"reqnotesfortech" ` + Reqpermission null.Val[int16] `db:"reqpermission" ` + Reqprogramactions null.Val[string] `db:"reqprogramactions" ` + Reqstate null.Val[string] `db:"reqstate" ` + Reqsubdiv null.Val[string] `db:"reqsubdiv" ` + Reqtarget null.Val[string] `db:"reqtarget" ` + Reqzip null.Val[string] `db:"reqzip" ` + Responsedaycount null.Val[int16] `db:"responsedaycount" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Scheduled null.Val[int16] `db:"scheduled" ` + Scheduleddate null.Val[int64] `db:"scheduleddate" ` + Source null.Val[string] `db:"source" ` + SRNumber null.Val[int64] `db:"sr_number" ` + Status null.Val[string] `db:"status" ` + Supervisor null.Val[string] `db:"supervisor" ` + Techclosed null.Val[string] `db:"techclosed" ` + Validx null.Val[string] `db:"validx" ` + Validy null.Val[string] `db:"validy" ` + Xvalue null.Val[string] `db:"xvalue" ` + Yvalue null.Val[string] `db:"yvalue" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX float64 `db:"geometry_x" ` + GeometryY float64 `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Dog null.Val[int64] `db:"dog" ` + Spanish null.Val[int64] `db:"spanish" ` + ScheduleNotes null.Val[string] `db:"schedule_notes" ` + SchedulePeriod null.Val[string] `db:"schedule_period" ` + Updated time.Time `db:"updated" ` R fsServicerequestR `db:"-" ` } @@ -341,96 +341,96 @@ func (fsServicerequestColumns) AliasedAs(alias string) fsServicerequestColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSServicerequestSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accepted omitnull.Val[int16] `db:"accepted" ` - Acceptedby omitnull.Val[string] `db:"acceptedby" ` - Accepteddate omitnull.Val[int64] `db:"accepteddate" ` - Allowed omitnull.Val[string] `db:"allowed" ` - Assignedtech omitnull.Val[string] `db:"assignedtech" ` - Clraddr1 omitnull.Val[string] `db:"clraddr1" ` - Clraddr2 omitnull.Val[string] `db:"clraddr2" ` - Clranon omitnull.Val[int16] `db:"clranon" ` - Clrcity omitnull.Val[string] `db:"clrcity" ` - Clrcompany omitnull.Val[string] `db:"clrcompany" ` - Clrcontpref omitnull.Val[string] `db:"clrcontpref" ` - Clremail omitnull.Val[string] `db:"clremail" ` - Clrfname omitnull.Val[string] `db:"clrfname" ` - Clrother omitnull.Val[string] `db:"clrother" ` - Clrphone1 omitnull.Val[string] `db:"clrphone1" ` - Clrphone2 omitnull.Val[string] `db:"clrphone2" ` - Clrstate omitnull.Val[string] `db:"clrstate" ` - Clrzip omitnull.Val[string] `db:"clrzip" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datetimeclosed omitnull.Val[int64] `db:"datetimeclosed" ` - Duedate omitnull.Val[int64] `db:"duedate" ` - Entrytech omitnull.Val[string] `db:"entrytech" ` - Estcompletedate omitnull.Val[int64] `db:"estcompletedate" ` - Externalerror omitnull.Val[string] `db:"externalerror" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Firstresponsedate omitnull.Val[int64] `db:"firstresponsedate" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Issuesreported omitnull.Val[string] `db:"issuesreported" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Nextaction omitnull.Val[string] `db:"nextaction" ` - Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` - Notified omitnull.Val[int16] `db:"notified" ` - Notifieddate omitnull.Val[int64] `db:"notifieddate" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Priority omitnull.Val[string] `db:"priority" ` - Recdatetime omitnull.Val[int64] `db:"recdatetime" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Rejectedby omitnull.Val[string] `db:"rejectedby" ` - Rejecteddate omitnull.Val[int64] `db:"rejecteddate" ` - Rejectedreason omitnull.Val[string] `db:"rejectedreason" ` - Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` - Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` - Reqcity omitnull.Val[string] `db:"reqcity" ` - Reqcompany omitnull.Val[string] `db:"reqcompany" ` - Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` - Reqdescr omitnull.Val[string] `db:"reqdescr" ` - Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` - Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` - Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` - Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` - Reqpermission omitnull.Val[int16] `db:"reqpermission" ` - Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` - Reqstate omitnull.Val[string] `db:"reqstate" ` - Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` - Reqtarget omitnull.Val[string] `db:"reqtarget" ` - Reqzip omitnull.Val[string] `db:"reqzip" ` - Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Scheduled omitnull.Val[int16] `db:"scheduled" ` - Scheduleddate omitnull.Val[int64] `db:"scheduleddate" ` - Source omitnull.Val[string] `db:"source" ` - SRNumber omitnull.Val[int64] `db:"sr_number" ` - Status omitnull.Val[string] `db:"status" ` - Supervisor omitnull.Val[string] `db:"supervisor" ` - Techclosed omitnull.Val[string] `db:"techclosed" ` - Validx omitnull.Val[string] `db:"validx" ` - Validy omitnull.Val[string] `db:"validy" ` - Xvalue omitnull.Val[string] `db:"xvalue" ` - Yvalue omitnull.Val[string] `db:"yvalue" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Dog omitnull.Val[int64] `db:"dog" ` - Spanish omitnull.Val[int64] `db:"spanish" ` - ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` - SchedulePeriod omitnull.Val[string] `db:"schedule_period" ` - Updated omit.Val[time.Time] `db:"updated" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accepted omitnull.Val[int16] `db:"accepted" ` + Acceptedby omitnull.Val[string] `db:"acceptedby" ` + Accepteddate omitnull.Val[int64] `db:"accepteddate" ` + Allowed omitnull.Val[string] `db:"allowed" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + Clraddr1 omitnull.Val[string] `db:"clraddr1" ` + Clraddr2 omitnull.Val[string] `db:"clraddr2" ` + Clranon omitnull.Val[int16] `db:"clranon" ` + Clrcity omitnull.Val[string] `db:"clrcity" ` + Clrcompany omitnull.Val[string] `db:"clrcompany" ` + Clrcontpref omitnull.Val[string] `db:"clrcontpref" ` + Clremail omitnull.Val[string] `db:"clremail" ` + Clrfname omitnull.Val[string] `db:"clrfname" ` + Clrother omitnull.Val[string] `db:"clrother" ` + Clrphone1 omitnull.Val[string] `db:"clrphone1" ` + Clrphone2 omitnull.Val[string] `db:"clrphone2" ` + Clrstate omitnull.Val[string] `db:"clrstate" ` + Clrzip omitnull.Val[string] `db:"clrzip" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Datetimeclosed omitnull.Val[int64] `db:"datetimeclosed" ` + Duedate omitnull.Val[int64] `db:"duedate" ` + Entrytech omitnull.Val[string] `db:"entrytech" ` + Estcompletedate omitnull.Val[int64] `db:"estcompletedate" ` + Externalerror omitnull.Val[string] `db:"externalerror" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Firstresponsedate omitnull.Val[int64] `db:"firstresponsedate" ` + Globalid omit.Val[string] `db:"globalid" ` + Issuesreported omitnull.Val[string] `db:"issuesreported" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Nextaction omitnull.Val[string] `db:"nextaction" ` + Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` + Notified omitnull.Val[int16] `db:"notified" ` + Notifieddate omitnull.Val[int64] `db:"notifieddate" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Priority omitnull.Val[string] `db:"priority" ` + Recdatetime omitnull.Val[int64] `db:"recdatetime" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Rejectedby omitnull.Val[string] `db:"rejectedby" ` + Rejecteddate omitnull.Val[int64] `db:"rejecteddate" ` + Rejectedreason omitnull.Val[string] `db:"rejectedreason" ` + Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` + Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` + Reqcity omitnull.Val[string] `db:"reqcity" ` + Reqcompany omitnull.Val[string] `db:"reqcompany" ` + Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` + Reqdescr omitnull.Val[string] `db:"reqdescr" ` + Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` + Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` + Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` + Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` + Reqpermission omitnull.Val[int16] `db:"reqpermission" ` + Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` + Reqstate omitnull.Val[string] `db:"reqstate" ` + Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` + Reqtarget omitnull.Val[string] `db:"reqtarget" ` + Reqzip omitnull.Val[string] `db:"reqzip" ` + Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Scheduled omitnull.Val[int16] `db:"scheduled" ` + Scheduleddate omitnull.Val[int64] `db:"scheduleddate" ` + Source omitnull.Val[string] `db:"source" ` + SRNumber omitnull.Val[int64] `db:"sr_number" ` + Status omitnull.Val[string] `db:"status" ` + Supervisor omitnull.Val[string] `db:"supervisor" ` + Techclosed omitnull.Val[string] `db:"techclosed" ` + Validx omitnull.Val[string] `db:"validx" ` + Validy omitnull.Val[string] `db:"validy" ` + Xvalue omitnull.Val[string] `db:"xvalue" ` + Yvalue omitnull.Val[string] `db:"yvalue" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omit.Val[float64] `db:"geometry_x" ` + GeometryY omit.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Dog omitnull.Val[int64] `db:"dog" ` + Spanish omitnull.Val[int64] `db:"spanish" ` + ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` + SchedulePeriod omitnull.Val[string] `db:"schedule_period" ` + Updated omit.Val[time.Time] `db:"updated" ` } func (s FSServicerequestSetter) SetColumns() []string { @@ -528,7 +528,7 @@ func (s FSServicerequestSetter) SetColumns() []string { if !s.Firstresponsedate.IsUnset() { vals = append(vals, "firstresponsedate") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Issuesreported.IsUnset() { @@ -678,10 +678,10 @@ func (s FSServicerequestSetter) SetColumns() []string { if !s.CreatedUser.IsUnset() { vals = append(vals, "created_user") } - if !s.GeometryX.IsUnset() { + if s.GeometryX.IsValue() { vals = append(vals, "geometry_x") } - if !s.GeometryY.IsUnset() { + if s.GeometryY.IsValue() { vals = append(vals, "geometry_y") } if !s.LastEditedDate.IsUnset() { @@ -802,8 +802,8 @@ func (s FSServicerequestSetter) Overwrite(t *FSServicerequest) { if !s.Firstresponsedate.IsUnset() { t.Firstresponsedate = s.Firstresponsedate.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Issuesreported.IsUnset() { t.Issuesreported = s.Issuesreported.MustGetNull() @@ -952,11 +952,11 @@ func (s FSServicerequestSetter) Overwrite(t *FSServicerequest) { if !s.CreatedUser.IsUnset() { t.CreatedUser = s.CreatedUser.MustGetNull() } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() + if s.GeometryX.IsValue() { + t.GeometryX = s.GeometryX.MustGet() } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() + if s.GeometryY.IsValue() { + t.GeometryY = s.GeometryY.MustGet() } if !s.LastEditedDate.IsUnset() { t.LastEditedDate = s.LastEditedDate.MustGetNull() @@ -1174,8 +1174,8 @@ func (s *FSServicerequestSetter) Apply(q *dialect.InsertQuery) { vals[30] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[31] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[31] = psql.Arg(s.Globalid.MustGet()) } else { vals[31] = psql.Raw("DEFAULT") } @@ -1474,14 +1474,14 @@ func (s *FSServicerequestSetter) Apply(q *dialect.InsertQuery) { vals[80] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[81] = psql.Arg(s.GeometryX.MustGetNull()) + if s.GeometryX.IsValue() { + vals[81] = psql.Arg(s.GeometryX.MustGet()) } else { vals[81] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[82] = psql.Arg(s.GeometryY.MustGetNull()) + if s.GeometryY.IsValue() { + vals[82] = psql.Arg(s.GeometryY.MustGet()) } else { vals[82] = psql.Raw("DEFAULT") } @@ -1756,7 +1756,7 @@ func (s FSServicerequestSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -2106,14 +2106,14 @@ func (s FSServicerequestSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.GeometryX.IsUnset() { + if s.GeometryX.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "geometry_x")...), psql.Arg(s.GeometryX), }}) } - if !s.GeometryY.IsUnset() { + if s.GeometryY.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "geometry_y")...), psql.Arg(s.GeometryY), @@ -2499,7 +2499,7 @@ type fsServicerequestWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Firstresponsedate psql.WhereNullMod[Q, int64] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Issuesreported psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] Nextaction psql.WhereNullMod[Q, string] @@ -2549,8 +2549,8 @@ type fsServicerequestWhere[Q psql.Filterable] struct { Zone2 psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] + GeometryX psql.WhereMod[Q, float64] + GeometryY psql.WhereMod[Q, float64] LastEditedDate psql.WhereNullMod[Q, int64] LastEditedUser psql.WhereNullMod[Q, string] Dog psql.WhereNullMod[Q, int64] @@ -2597,7 +2597,7 @@ func buildFSServicerequestWhere[Q psql.Filterable](cols fsServicerequestColumns) Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Firstresponsedate: psql.WhereNull[Q, int64](cols.Firstresponsedate), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Issuesreported: psql.WhereNull[Q, string](cols.Issuesreported), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), Nextaction: psql.WhereNull[Q, string](cols.Nextaction), @@ -2647,8 +2647,8 @@ func buildFSServicerequestWhere[Q psql.Filterable](cols fsServicerequestColumns) Zone2: psql.WhereNull[Q, string](cols.Zone2), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), - GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), - GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), + GeometryX: psql.Where[Q, float64](cols.GeometryX), + GeometryY: psql.Where[Q, float64](cols.GeometryY), LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), Dog: psql.WhereNull[Q, int64](cols.Dog), diff --git a/models/fs_speciesabundance.bob.go b/models/fs_speciesabundance.bob.go index f227471f..87938620 100644 --- a/models/fs_speciesabundance.bob.go +++ b/models/fs_speciesabundance.bob.go @@ -35,7 +35,7 @@ type FSSpeciesabundance struct { Editor null.Val[string] `db:"editor" ` Females null.Val[int64] `db:"females" ` Gravidfem null.Val[int16] `db:"gravidfem" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Larvae null.Val[int16] `db:"larvae" ` Males null.Val[int16] `db:"males" ` Objectid int32 `db:"objectid,pk" ` @@ -179,7 +179,7 @@ type FSSpeciesabundanceSetter struct { Editor omitnull.Val[string] `db:"editor" ` Females omitnull.Val[int64] `db:"females" ` Gravidfem omitnull.Val[int16] `db:"gravidfem" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Larvae omitnull.Val[int16] `db:"larvae" ` Males omitnull.Val[int16] `db:"males" ` Objectid omit.Val[int32] `db:"objectid,pk" ` @@ -234,7 +234,7 @@ func (s FSSpeciesabundanceSetter) SetColumns() []string { if !s.Gravidfem.IsUnset() { vals = append(vals, "gravidfem") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Larvae.IsUnset() { @@ -337,8 +337,8 @@ func (s FSSpeciesabundanceSetter) Overwrite(t *FSSpeciesabundance) { if !s.Gravidfem.IsUnset() { t.Gravidfem = s.Gravidfem.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Larvae.IsUnset() { t.Larvae = s.Larvae.MustGetNull() @@ -472,8 +472,8 @@ func (s *FSSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { vals[8] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[9] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[9] = psql.Arg(s.Globalid.MustGet()) } else { vals[9] = psql.Raw("DEFAULT") } @@ -690,7 +690,7 @@ func (s FSSpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1166,7 +1166,7 @@ type fsSpeciesabundanceWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] Females psql.WhereNullMod[Q, int64] Gravidfem psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Larvae psql.WhereNullMod[Q, int16] Males psql.WhereNullMod[Q, int16] Objectid psql.WhereMod[Q, int32] @@ -1207,7 +1207,7 @@ func buildFSSpeciesabundanceWhere[Q psql.Filterable](cols fsSpeciesabundanceColu Editor: psql.WhereNull[Q, string](cols.Editor), Females: psql.WhereNull[Q, int64](cols.Females), Gravidfem: psql.WhereNull[Q, int16](cols.Gravidfem), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Larvae: psql.WhereNull[Q, int16](cols.Larvae), Males: psql.WhereNull[Q, int16](cols.Males), Objectid: psql.Where[Q, int32](cols.Objectid), diff --git a/models/fs_stormdrain.bob.go b/models/fs_stormdrain.bob.go index 6f736d8f..a9448003 100644 --- a/models/fs_stormdrain.bob.go +++ b/models/fs_stormdrain.bob.go @@ -31,7 +31,7 @@ type FSStormdrain struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Jurisdiction null.Val[string] `db:"jurisdiction" ` Lastaction null.Val[string] `db:"lastaction" ` Laststatus null.Val[string] `db:"laststatus" ` @@ -145,7 +145,7 @@ type FSStormdrainSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` Lastaction omitnull.Val[string] `db:"lastaction" ` Laststatus omitnull.Val[string] `db:"laststatus" ` @@ -182,7 +182,7 @@ func (s FSStormdrainSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Jurisdiction.IsUnset() { @@ -255,8 +255,8 @@ func (s FSStormdrainSetter) Overwrite(t *FSStormdrain) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Jurisdiction.IsUnset() { t.Jurisdiction = s.Jurisdiction.MustGetNull() @@ -348,8 +348,8 @@ func (s *FSStormdrainSetter) Apply(q *dialect.InsertQuery) { vals[4] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[5] = psql.Arg(s.Globalid.MustGet()) } else { vals[5] = psql.Raw("DEFAULT") } @@ -502,7 +502,7 @@ func (s FSStormdrainSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -932,7 +932,7 @@ type fsStormdrainWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] Lastaction psql.WhereNullMod[Q, string] Laststatus psql.WhereNullMod[Q, string] @@ -963,7 +963,7 @@ func buildFSStormdrainWhere[Q psql.Filterable](cols fsStormdrainColumns) fsStorm Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), Lastaction: psql.WhereNull[Q, string](cols.Lastaction), Laststatus: psql.WhereNull[Q, string](cols.Laststatus), diff --git a/models/fs_timecard.bob.go b/models/fs_timecard.bob.go index 6cdcc858..a52fe0b5 100644 --- a/models/fs_timecard.bob.go +++ b/models/fs_timecard.bob.go @@ -37,7 +37,7 @@ type FSTimecard struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Lclocid null.Val[string] `db:"lclocid" ` Linelocid null.Val[string] `db:"linelocid" ` Locationname null.Val[string] `db:"locationname" ` @@ -178,7 +178,7 @@ type FSTimecardSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Lclocid omitnull.Val[string] `db:"lclocid" ` Linelocid omitnull.Val[string] `db:"linelocid" ` Locationname omitnull.Val[string] `db:"locationname" ` @@ -236,7 +236,7 @@ func (s FSTimecardSetter) SetColumns() []string { if !s.Fieldtech.IsUnset() { vals = append(vals, "fieldtech") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Lclocid.IsUnset() { @@ -336,8 +336,8 @@ func (s FSTimecardSetter) Overwrite(t *FSTimecard) { if !s.Fieldtech.IsUnset() { t.Fieldtech = s.Fieldtech.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Lclocid.IsUnset() { t.Lclocid = s.Lclocid.MustGetNull() @@ -474,8 +474,8 @@ func (s *FSTimecardSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -688,7 +688,7 @@ func (s FSTimecardSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1145,7 +1145,7 @@ type fsTimecardWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Lclocid psql.WhereNullMod[Q, string] Linelocid psql.WhereNullMod[Q, string] Locationname psql.WhereNullMod[Q, string] @@ -1185,7 +1185,7 @@ func buildFSTimecardWhere[Q psql.Filterable](cols fsTimecardColumns) fsTimecardW Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Lclocid: psql.WhereNull[Q, string](cols.Lclocid), Linelocid: psql.WhereNull[Q, string](cols.Linelocid), Locationname: psql.WhereNull[Q, string](cols.Locationname), diff --git a/models/fs_trapdata.bob.go b/models/fs_trapdata.bob.go index 02dc6da4..c17d48c0 100644 --- a/models/fs_trapdata.bob.go +++ b/models/fs_trapdata.bob.go @@ -37,7 +37,7 @@ type FSTrapdatum struct { Fieldtech null.Val[string] `db:"fieldtech" ` Field null.Val[int64] `db:"field" ` Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Idbytech null.Val[string] `db:"idbytech" ` Locationname null.Val[string] `db:"locationname" ` LocID null.Val[string] `db:"loc_id" ` @@ -220,7 +220,7 @@ type FSTrapdatumSetter struct { Fieldtech omitnull.Val[string] `db:"fieldtech" ` Field omitnull.Val[int64] `db:"field" ` Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Idbytech omitnull.Val[string] `db:"idbytech" ` Locationname omitnull.Val[string] `db:"locationname" ` LocID omitnull.Val[string] `db:"loc_id" ` @@ -292,7 +292,7 @@ func (s FSTrapdatumSetter) SetColumns() []string { if !s.Gatewaysync.IsUnset() { vals = append(vals, "gatewaysync") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Idbytech.IsUnset() { @@ -434,8 +434,8 @@ func (s FSTrapdatumSetter) Overwrite(t *FSTrapdatum) { if !s.Gatewaysync.IsUnset() { t.Gatewaysync = s.Gatewaysync.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Idbytech.IsUnset() { t.Idbytech = s.Idbytech.MustGetNull() @@ -614,8 +614,8 @@ func (s *FSTrapdatumSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -912,7 +912,7 @@ func (s FSTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1467,7 +1467,7 @@ type fsTrapdatumWhere[Q psql.Filterable] struct { Fieldtech psql.WhereNullMod[Q, string] Field psql.WhereNullMod[Q, int64] Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Idbytech psql.WhereNullMod[Q, string] Locationname psql.WhereNullMod[Q, string] LocID psql.WhereNullMod[Q, string] @@ -1521,7 +1521,7 @@ func buildFSTrapdatumWhere[Q psql.Filterable](cols fsTrapdatumColumns) fsTrapdat Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Field: psql.WhereNull[Q, int64](cols.Field), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Idbytech: psql.WhereNull[Q, string](cols.Idbytech), Locationname: psql.WhereNull[Q, string](cols.Locationname), LocID: psql.WhereNull[Q, string](cols.LocID), diff --git a/models/fs_traplocation.bob.go b/models/fs_traplocation.bob.go index 8d757971..7e2c38ff 100644 --- a/models/fs_traplocation.bob.go +++ b/models/fs_traplocation.bob.go @@ -37,7 +37,7 @@ type FSTraplocation struct { Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` Locationnumber null.Val[int64] `db:"locationnumber" ` Name null.Val[string] `db:"name" ` @@ -184,7 +184,7 @@ type FSTraplocationSetter struct { Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` Locationnumber omitnull.Val[int64] `db:"locationnumber" ` Name omitnull.Val[string] `db:"name" ` @@ -244,7 +244,7 @@ func (s FSTraplocationSetter) SetColumns() []string { if !s.Gatewaysync.IsUnset() { vals = append(vals, "gatewaysync") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -350,8 +350,8 @@ func (s FSTraplocationSetter) Overwrite(t *FSTraplocation) { if !s.Gatewaysync.IsUnset() { t.Gatewaysync = s.Gatewaysync.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -494,8 +494,8 @@ func (s *FSTraplocationSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[11] = psql.Arg(s.Globalid.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } @@ -720,7 +720,7 @@ func (s FSTraplocationSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1191,7 +1191,7 @@ type fsTraplocationWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] Locationnumber psql.WhereNullMod[Q, int64] Name psql.WhereNullMod[Q, string] @@ -1233,7 +1233,7 @@ func buildFSTraplocationWhere[Q psql.Filterable](cols fsTraplocationColumns) fsT Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), Name: psql.WhereNull[Q, string](cols.Name), diff --git a/models/fs_treatment.bob.go b/models/fs_treatment.bob.go index 4a6d86ce..169ecbe1 100644 --- a/models/fs_treatment.bob.go +++ b/models/fs_treatment.bob.go @@ -42,7 +42,7 @@ type FSTreatment struct { Editor null.Val[string] `db:"editor" ` Fieldtech null.Val[string] `db:"fieldtech" ` Flowrate null.Val[float64] `db:"flowrate" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Habitat null.Val[string] `db:"habitat" ` InspID null.Val[string] `db:"insp_id" ` Invloc null.Val[string] `db:"invloc" ` @@ -261,7 +261,7 @@ type FSTreatmentSetter struct { Editor omitnull.Val[string] `db:"editor" ` Fieldtech omitnull.Val[string] `db:"fieldtech" ` Flowrate omitnull.Val[float64] `db:"flowrate" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Habitat omitnull.Val[string] `db:"habitat" ` InspID omitnull.Val[string] `db:"insp_id" ` Invloc omitnull.Val[string] `db:"invloc" ` @@ -355,7 +355,7 @@ func (s FSTreatmentSetter) SetColumns() []string { if !s.Flowrate.IsUnset() { vals = append(vals, "flowrate") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Habitat.IsUnset() { @@ -533,8 +533,8 @@ func (s FSTreatmentSetter) Overwrite(t *FSTreatment) { if !s.Flowrate.IsUnset() { t.Flowrate = s.Flowrate.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Habitat.IsUnset() { t.Habitat = s.Habitat.MustGetNull() @@ -764,8 +764,8 @@ func (s *FSTreatmentSetter) Apply(q *dialect.InsertQuery) { vals[15] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[16] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[16] = psql.Arg(s.Globalid.MustGet()) } else { vals[16] = psql.Raw("DEFAULT") } @@ -1139,7 +1139,7 @@ func (s FSTreatmentSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -1748,7 +1748,7 @@ type fsTreatmentWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] Flowrate psql.WhereNullMod[Q, float64] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Habitat psql.WhereNullMod[Q, string] InspID psql.WhereNullMod[Q, string] Invloc psql.WhereNullMod[Q, string] @@ -1814,7 +1814,7 @@ func buildFSTreatmentWhere[Q psql.Filterable](cols fsTreatmentColumns) fsTreatme Editor: psql.WhereNull[Q, string](cols.Editor), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Flowrate: psql.WhereNull[Q, float64](cols.Flowrate), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Habitat: psql.WhereNull[Q, string](cols.Habitat), InspID: psql.WhereNull[Q, string](cols.InspID), Invloc: psql.WhereNull[Q, string](cols.Invloc), diff --git a/models/fs_treatmentarea.bob.go b/models/fs_treatmentarea.bob.go index 4a7f76fe..ab74a35d 100644 --- a/models/fs_treatmentarea.bob.go +++ b/models/fs_treatmentarea.bob.go @@ -32,7 +32,7 @@ type FSTreatmentarea struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Notified null.Val[int16] `db:"notified" ` Objectid int32 `db:"objectid,pk" ` SessionID null.Val[string] `db:"session_id" ` @@ -143,7 +143,7 @@ type FSTreatmentareaSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Notified omitnull.Val[int16] `db:"notified" ` Objectid omit.Val[int32] `db:"objectid,pk" ` SessionID omitnull.Val[string] `db:"session_id" ` @@ -181,7 +181,7 @@ func (s FSTreatmentareaSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Notified.IsUnset() { @@ -251,8 +251,8 @@ func (s FSTreatmentareaSetter) Overwrite(t *FSTreatmentarea) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Notified.IsUnset() { t.Notified = s.Notified.MustGetNull() @@ -344,8 +344,8 @@ func (s *FSTreatmentareaSetter) Apply(q *dialect.InsertQuery) { vals[5] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[6] = psql.Arg(s.Globalid.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } @@ -493,7 +493,7 @@ func (s FSTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -910,7 +910,7 @@ type fsTreatmentareaWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Notified psql.WhereNullMod[Q, int16] Objectid psql.WhereMod[Q, int32] SessionID psql.WhereNullMod[Q, string] @@ -940,7 +940,7 @@ func buildFSTreatmentareaWhere[Q psql.Filterable](cols fsTreatmentareaColumns) f Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Notified: psql.WhereNull[Q, int16](cols.Notified), Objectid: psql.Where[Q, int32](cols.Objectid), SessionID: psql.WhereNull[Q, string](cols.SessionID), diff --git a/models/fs_zones.bob.go b/models/fs_zones.bob.go index 8610ccdf..980bb838 100644 --- a/models/fs_zones.bob.go +++ b/models/fs_zones.bob.go @@ -32,7 +32,7 @@ type FSZone struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Name null.Val[string] `db:"name" ` Objectid int32 `db:"objectid,pk" ` ShapeArea null.Val[float64] `db:"shape__area" ` @@ -131,7 +131,7 @@ type FSZoneSetter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Name omitnull.Val[string] `db:"name" ` Objectid omit.Val[int32] `db:"objectid,pk" ` ShapeArea omitnull.Val[float64] `db:"shape__area" ` @@ -165,7 +165,7 @@ func (s FSZoneSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Name.IsUnset() { @@ -223,8 +223,8 @@ func (s FSZoneSetter) Overwrite(t *FSZone) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Name.IsUnset() { t.Name = s.Name.MustGetNull() @@ -304,8 +304,8 @@ func (s *FSZoneSetter) Apply(q *dialect.InsertQuery) { vals[5] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[6] = psql.Arg(s.Globalid.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } @@ -429,7 +429,7 @@ func (s FSZoneSetter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -818,7 +818,7 @@ type fsZoneWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Name psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] ShapeArea psql.WhereNullMod[Q, float64] @@ -844,7 +844,7 @@ func buildFSZoneWhere[Q psql.Filterable](cols fsZoneColumns) fsZoneWhere[Q] { Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Name: psql.WhereNull[Q, string](cols.Name), Objectid: psql.Where[Q, int32](cols.Objectid), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), diff --git a/models/fs_zones2.bob.go b/models/fs_zones2.bob.go index c454f752..696c22ba 100644 --- a/models/fs_zones2.bob.go +++ b/models/fs_zones2.bob.go @@ -31,7 +31,7 @@ type FSZones2 struct { Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` + Globalid string `db:"globalid" ` Name null.Val[string] `db:"name" ` Objectid int32 `db:"objectid,pk" ` ShapeArea null.Val[float64] `db:"shape__area" ` @@ -127,7 +127,7 @@ type FSZones2Setter struct { Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` + Globalid omit.Val[string] `db:"globalid" ` Name omitnull.Val[string] `db:"name" ` Objectid omit.Val[int32] `db:"objectid,pk" ` ShapeArea omitnull.Val[float64] `db:"shape__area" ` @@ -158,7 +158,7 @@ func (s FSZones2Setter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { vals = append(vals, "globalid") } if !s.Name.IsUnset() { @@ -213,8 +213,8 @@ func (s FSZones2Setter) Overwrite(t *FSZones2) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() + if s.Globalid.IsValue() { + t.Globalid = s.Globalid.MustGet() } if !s.Name.IsUnset() { t.Name = s.Name.MustGetNull() @@ -288,8 +288,8 @@ func (s *FSZones2Setter) Apply(q *dialect.InsertQuery) { vals[4] = psql.Raw("DEFAULT") } - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) + if s.Globalid.IsValue() { + vals[5] = psql.Arg(s.Globalid.MustGet()) } else { vals[5] = psql.Raw("DEFAULT") } @@ -406,7 +406,7 @@ func (s FSZones2Setter) Expressions(prefix ...string) []bob.Expression { }}) } - if !s.Globalid.IsUnset() { + if s.Globalid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "globalid")...), psql.Arg(s.Globalid), @@ -794,7 +794,7 @@ type fsZones2Where[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] + Globalid psql.WhereMod[Q, string] Name psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] ShapeArea psql.WhereNullMod[Q, float64] @@ -819,7 +819,7 @@ func buildFSZones2Where[Q psql.Filterable](cols fsZones2Columns) fsZones2Where[Q Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Globalid: psql.WhereNull[Q, string](cols.Globalid), + Globalid: psql.Where[Q, string](cols.Globalid), Name: psql.WhereNull[Q, string](cols.Name), Objectid: psql.Where[Q, int32](cols.Objectid), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), diff --git a/models/geography_columns.bob.go b/models/geography_columns.bob.go new file mode 100644 index 00000000..194b4b4a --- /dev/null +++ b/models/geography_columns.bob.go @@ -0,0 +1,120 @@ +// 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 models + +import ( + "context" + + "github.com/aarondl/opt/null" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/expr" +) + +// GeographyColumn is an object representing the database table. +type GeographyColumn struct { + FTableCatalog null.Val[string] `db:"f_table_catalog" ` + FTableSchema null.Val[string] `db:"f_table_schema" ` + FTableName null.Val[string] `db:"f_table_name" ` + FGeographyColumn null.Val[string] `db:"f_geography_column" ` + CoordDimension null.Val[int32] `db:"coord_dimension" ` + Srid null.Val[int32] `db:"srid" ` + Type null.Val[string] `db:"type" ` +} + +// GeographyColumnSlice is an alias for a slice of pointers to GeographyColumn. +// This should almost always be used instead of []*GeographyColumn. +type GeographyColumnSlice []*GeographyColumn + +// GeographyColumns contains methods to work with the geography_columns view +var GeographyColumns = psql.NewViewx[*GeographyColumn, GeographyColumnSlice]("", "geography_columns", buildGeographyColumnColumns("geography_columns")) + +// GeographyColumnsQuery is a query on the geography_columns view +type GeographyColumnsQuery = *psql.ViewQuery[*GeographyColumn, GeographyColumnSlice] + +func buildGeographyColumnColumns(alias string) geographyColumnColumns { + return geographyColumnColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "f_table_catalog", "f_table_schema", "f_table_name", "f_geography_column", "coord_dimension", "srid", "type", + ).WithParent("geography_columns"), + tableAlias: alias, + FTableCatalog: psql.Quote(alias, "f_table_catalog"), + FTableSchema: psql.Quote(alias, "f_table_schema"), + FTableName: psql.Quote(alias, "f_table_name"), + FGeographyColumn: psql.Quote(alias, "f_geography_column"), + CoordDimension: psql.Quote(alias, "coord_dimension"), + Srid: psql.Quote(alias, "srid"), + Type: psql.Quote(alias, "type"), + } +} + +type geographyColumnColumns struct { + expr.ColumnsExpr + tableAlias string + FTableCatalog psql.Expression + FTableSchema psql.Expression + FTableName psql.Expression + FGeographyColumn psql.Expression + CoordDimension psql.Expression + Srid psql.Expression + Type psql.Expression +} + +func (c geographyColumnColumns) Alias() string { + return c.tableAlias +} + +func (geographyColumnColumns) AliasedAs(alias string) geographyColumnColumns { + return buildGeographyColumnColumns(alias) +} + +// AfterQueryHook is called after GeographyColumn is retrieved from the database +func (o *GeographyColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = GeographyColumns.AfterSelectHooks.RunHooks(ctx, exec, GeographyColumnSlice{o}) + } + + return err +} + +// AfterQueryHook is called after GeographyColumnSlice is retrieved from the database +func (o GeographyColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = GeographyColumns.AfterSelectHooks.RunHooks(ctx, exec, o) + } + + return err +} + +type geographyColumnWhere[Q psql.Filterable] struct { + FTableCatalog psql.WhereNullMod[Q, string] + FTableSchema psql.WhereNullMod[Q, string] + FTableName psql.WhereNullMod[Q, string] + FGeographyColumn psql.WhereNullMod[Q, string] + CoordDimension psql.WhereNullMod[Q, int32] + Srid psql.WhereNullMod[Q, int32] + Type psql.WhereNullMod[Q, string] +} + +func (geographyColumnWhere[Q]) AliasedAs(alias string) geographyColumnWhere[Q] { + return buildGeographyColumnWhere[Q](buildGeographyColumnColumns(alias)) +} + +func buildGeographyColumnWhere[Q psql.Filterable](cols geographyColumnColumns) geographyColumnWhere[Q] { + return geographyColumnWhere[Q]{ + FTableCatalog: psql.WhereNull[Q, string](cols.FTableCatalog), + FTableSchema: psql.WhereNull[Q, string](cols.FTableSchema), + FTableName: psql.WhereNull[Q, string](cols.FTableName), + FGeographyColumn: psql.WhereNull[Q, string](cols.FGeographyColumn), + CoordDimension: psql.WhereNull[Q, int32](cols.CoordDimension), + Srid: psql.WhereNull[Q, int32](cols.Srid), + Type: psql.WhereNull[Q, string](cols.Type), + } +} diff --git a/models/geometry_columns.bob.go b/models/geometry_columns.bob.go new file mode 100644 index 00000000..38a7c6be --- /dev/null +++ b/models/geometry_columns.bob.go @@ -0,0 +1,120 @@ +// 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 models + +import ( + "context" + + "github.com/aarondl/opt/null" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/expr" +) + +// GeometryColumn is an object representing the database table. +type GeometryColumn struct { + FTableCatalog null.Val[string] `db:"f_table_catalog" ` + FTableSchema null.Val[string] `db:"f_table_schema" ` + FTableName null.Val[string] `db:"f_table_name" ` + FGeometryColumn null.Val[string] `db:"f_geometry_column" ` + CoordDimension null.Val[int32] `db:"coord_dimension" ` + Srid null.Val[int32] `db:"srid" ` + Type null.Val[string] `db:"type" ` +} + +// GeometryColumnSlice is an alias for a slice of pointers to GeometryColumn. +// This should almost always be used instead of []*GeometryColumn. +type GeometryColumnSlice []*GeometryColumn + +// GeometryColumns contains methods to work with the geometry_columns view +var GeometryColumns = psql.NewViewx[*GeometryColumn, GeometryColumnSlice]("", "geometry_columns", buildGeometryColumnColumns("geometry_columns")) + +// GeometryColumnsQuery is a query on the geometry_columns view +type GeometryColumnsQuery = *psql.ViewQuery[*GeometryColumn, GeometryColumnSlice] + +func buildGeometryColumnColumns(alias string) geometryColumnColumns { + return geometryColumnColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "f_table_catalog", "f_table_schema", "f_table_name", "f_geometry_column", "coord_dimension", "srid", "type", + ).WithParent("geometry_columns"), + tableAlias: alias, + FTableCatalog: psql.Quote(alias, "f_table_catalog"), + FTableSchema: psql.Quote(alias, "f_table_schema"), + FTableName: psql.Quote(alias, "f_table_name"), + FGeometryColumn: psql.Quote(alias, "f_geometry_column"), + CoordDimension: psql.Quote(alias, "coord_dimension"), + Srid: psql.Quote(alias, "srid"), + Type: psql.Quote(alias, "type"), + } +} + +type geometryColumnColumns struct { + expr.ColumnsExpr + tableAlias string + FTableCatalog psql.Expression + FTableSchema psql.Expression + FTableName psql.Expression + FGeometryColumn psql.Expression + CoordDimension psql.Expression + Srid psql.Expression + Type psql.Expression +} + +func (c geometryColumnColumns) Alias() string { + return c.tableAlias +} + +func (geometryColumnColumns) AliasedAs(alias string) geometryColumnColumns { + return buildGeometryColumnColumns(alias) +} + +// AfterQueryHook is called after GeometryColumn is retrieved from the database +func (o *GeometryColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = GeometryColumns.AfterSelectHooks.RunHooks(ctx, exec, GeometryColumnSlice{o}) + } + + return err +} + +// AfterQueryHook is called after GeometryColumnSlice is retrieved from the database +func (o GeometryColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = GeometryColumns.AfterSelectHooks.RunHooks(ctx, exec, o) + } + + return err +} + +type geometryColumnWhere[Q psql.Filterable] struct { + FTableCatalog psql.WhereNullMod[Q, string] + FTableSchema psql.WhereNullMod[Q, string] + FTableName psql.WhereNullMod[Q, string] + FGeometryColumn psql.WhereNullMod[Q, string] + CoordDimension psql.WhereNullMod[Q, int32] + Srid psql.WhereNullMod[Q, int32] + Type psql.WhereNullMod[Q, string] +} + +func (geometryColumnWhere[Q]) AliasedAs(alias string) geometryColumnWhere[Q] { + return buildGeometryColumnWhere[Q](buildGeometryColumnColumns(alias)) +} + +func buildGeometryColumnWhere[Q psql.Filterable](cols geometryColumnColumns) geometryColumnWhere[Q] { + return geometryColumnWhere[Q]{ + FTableCatalog: psql.WhereNull[Q, string](cols.FTableCatalog), + FTableSchema: psql.WhereNull[Q, string](cols.FTableSchema), + FTableName: psql.WhereNull[Q, string](cols.FTableName), + FGeometryColumn: psql.WhereNull[Q, string](cols.FGeometryColumn), + CoordDimension: psql.WhereNull[Q, int32](cols.CoordDimension), + Srid: psql.WhereNull[Q, int32](cols.Srid), + Type: psql.WhereNull[Q, string](cols.Type), + } +} diff --git a/models/h3_aggregation.bob.go b/models/h3_aggregation.bob.go new file mode 100644 index 00000000..3a01527a --- /dev/null +++ b/models/h3_aggregation.bob.go @@ -0,0 +1,703 @@ +// 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 models + +import ( + "context" + "fmt" + "io" + + enums "github.com/Gleipnir-Technology/nidus-sync/enums" + "github.com/aarondl/opt/omit" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/dialect/psql/dialect" + "github.com/stephenafamo/bob/dialect/psql/dm" + "github.com/stephenafamo/bob/dialect/psql/sm" + "github.com/stephenafamo/bob/dialect/psql/um" + "github.com/stephenafamo/bob/expr" + "github.com/stephenafamo/bob/mods" + "github.com/stephenafamo/bob/orm" + "github.com/stephenafamo/bob/types/pgtypes" +) + +// H3Aggregation is an object representing the database table. +type H3Aggregation struct { + ID int32 `db:"id,pk" ` + Cell string `db:"cell" ` + Resolution int32 `db:"resolution" ` + Count int32 `db:"count_" ` + Type enums.H3aggregationtype `db:"type_" ` + OrganizationID int32 `db:"organization_id" ` + + R h3AggregationR `db:"-" ` +} + +// H3AggregationSlice is an alias for a slice of pointers to H3Aggregation. +// This should almost always be used instead of []*H3Aggregation. +type H3AggregationSlice []*H3Aggregation + +// H3Aggregations contains methods to work with the h3_aggregation table +var H3Aggregations = psql.NewTablex[*H3Aggregation, H3AggregationSlice, *H3AggregationSetter]("", "h3_aggregation", buildH3AggregationColumns("h3_aggregation")) + +// H3AggregationsQuery is a query on the h3_aggregation table +type H3AggregationsQuery = *psql.ViewQuery[*H3Aggregation, H3AggregationSlice] + +// h3AggregationR is where relationships are stored. +type h3AggregationR struct { + Organization *Organization // h3_aggregation.h3_aggregation_organization_id_fkey +} + +func buildH3AggregationColumns(alias string) h3AggregationColumns { + return h3AggregationColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "id", "cell", "resolution", "count_", "type_", "organization_id", + ).WithParent("h3_aggregation"), + tableAlias: alias, + ID: psql.Quote(alias, "id"), + Cell: psql.Quote(alias, "cell"), + Resolution: psql.Quote(alias, "resolution"), + Count: psql.Quote(alias, "count_"), + Type: psql.Quote(alias, "type_"), + OrganizationID: psql.Quote(alias, "organization_id"), + } +} + +type h3AggregationColumns struct { + expr.ColumnsExpr + tableAlias string + ID psql.Expression + Cell psql.Expression + Resolution psql.Expression + Count psql.Expression + Type psql.Expression + OrganizationID psql.Expression +} + +func (c h3AggregationColumns) Alias() string { + return c.tableAlias +} + +func (h3AggregationColumns) AliasedAs(alias string) h3AggregationColumns { + return buildH3AggregationColumns(alias) +} + +// H3AggregationSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type H3AggregationSetter struct { + ID omit.Val[int32] `db:"id,pk" ` + Cell omit.Val[string] `db:"cell" ` + Resolution omit.Val[int32] `db:"resolution" ` + Count omit.Val[int32] `db:"count_" ` + Type omit.Val[enums.H3aggregationtype] `db:"type_" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` +} + +func (s H3AggregationSetter) SetColumns() []string { + vals := make([]string, 0, 6) + if s.ID.IsValue() { + vals = append(vals, "id") + } + if s.Cell.IsValue() { + vals = append(vals, "cell") + } + if s.Resolution.IsValue() { + vals = append(vals, "resolution") + } + if s.Count.IsValue() { + vals = append(vals, "count_") + } + if s.Type.IsValue() { + vals = append(vals, "type_") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + return vals +} + +func (s H3AggregationSetter) Overwrite(t *H3Aggregation) { + if s.ID.IsValue() { + t.ID = s.ID.MustGet() + } + if s.Cell.IsValue() { + t.Cell = s.Cell.MustGet() + } + if s.Resolution.IsValue() { + t.Resolution = s.Resolution.MustGet() + } + if s.Count.IsValue() { + t.Count = s.Count.MustGet() + } + if s.Type.IsValue() { + t.Type = s.Type.MustGet() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } +} + +func (s *H3AggregationSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return H3Aggregations.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 6) + if s.ID.IsValue() { + vals[0] = psql.Arg(s.ID.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.Cell.IsValue() { + vals[1] = psql.Arg(s.Cell.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.Resolution.IsValue() { + vals[2] = psql.Arg(s.Resolution.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.Count.IsValue() { + vals[3] = psql.Arg(s.Count.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.Type.IsValue() { + vals[4] = psql.Arg(s.Type.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[5] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s H3AggregationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s H3AggregationSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 6) + + if s.ID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "id")...), + psql.Arg(s.ID), + }}) + } + + if s.Cell.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cell")...), + psql.Arg(s.Cell), + }}) + } + + if s.Resolution.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "resolution")...), + psql.Arg(s.Resolution), + }}) + } + + if s.Count.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "count_")...), + psql.Arg(s.Count), + }}) + } + + if s.Type.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type_")...), + psql.Arg(s.Type), + }}) + } + + if s.OrganizationID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + return exprs +} + +// FindH3Aggregation retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindH3Aggregation(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*H3Aggregation, error) { + if len(cols) == 0 { + return H3Aggregations.Query( + sm.Where(H3Aggregations.Columns.ID.EQ(psql.Arg(IDPK))), + ).One(ctx, exec) + } + + return H3Aggregations.Query( + sm.Where(H3Aggregations.Columns.ID.EQ(psql.Arg(IDPK))), + sm.Columns(H3Aggregations.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// H3AggregationExists checks the presence of a single record by primary key +func H3AggregationExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { + return H3Aggregations.Query( + sm.Where(H3Aggregations.Columns.ID.EQ(psql.Arg(IDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after H3Aggregation is retrieved from the database +func (o *H3Aggregation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = H3Aggregations.AfterSelectHooks.RunHooks(ctx, exec, H3AggregationSlice{o}) + case bob.QueryTypeInsert: + ctx, err = H3Aggregations.AfterInsertHooks.RunHooks(ctx, exec, H3AggregationSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = H3Aggregations.AfterUpdateHooks.RunHooks(ctx, exec, H3AggregationSlice{o}) + case bob.QueryTypeDelete: + ctx, err = H3Aggregations.AfterDeleteHooks.RunHooks(ctx, exec, H3AggregationSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the H3Aggregation +func (o *H3Aggregation) primaryKeyVals() bob.Expression { + return psql.Arg(o.ID) +} + +func (o *H3Aggregation) pkEQ() dialect.Expression { + return psql.Quote("h3_aggregation", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the H3Aggregation +func (o *H3Aggregation) Update(ctx context.Context, exec bob.Executor, s *H3AggregationSetter) error { + v, err := H3Aggregations.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec) + if err != nil { + return err + } + + o.R = v.R + *o = *v + + return nil +} + +// Delete deletes a single H3Aggregation record with an executor +func (o *H3Aggregation) Delete(ctx context.Context, exec bob.Executor) error { + _, err := H3Aggregations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the H3Aggregation using the executor +func (o *H3Aggregation) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := H3Aggregations.Query( + sm.Where(H3Aggregations.Columns.ID.EQ(psql.Arg(o.ID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after H3AggregationSlice is retrieved from the database +func (o H3AggregationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = H3Aggregations.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = H3Aggregations.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = H3Aggregations.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = H3Aggregations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o H3AggregationSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("h3_aggregation", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + pkPairs := make([]bob.Expression, len(o)) + for i, row := range o { + pkPairs[i] = row.primaryKeyVals() + } + return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "") + })) +} + +// copyMatchingRows finds models in the given slice that have the same primary key +// then it first copies the existing relationships from the old model to the new model +// and then replaces the old model in the slice with the new model +func (o H3AggregationSlice) copyMatchingRows(from ...*H3Aggregation) { + for i, old := range o { + for _, new := range from { + if new.ID != old.ID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o H3AggregationSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return H3Aggregations.BeforeUpdateHooks.RunHooks(ctx, exec, o) + }) + + q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { + var err error + switch retrieved := retrieved.(type) { + case *H3Aggregation: + o.copyMatchingRows(retrieved) + case []*H3Aggregation: + o.copyMatchingRows(retrieved...) + case H3AggregationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a H3Aggregation or a slice of H3Aggregation + // then run the AfterUpdateHooks on the slice + _, err = H3Aggregations.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o H3AggregationSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] { + return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return H3Aggregations.BeforeDeleteHooks.RunHooks(ctx, exec, o) + }) + + q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { + var err error + switch retrieved := retrieved.(type) { + case *H3Aggregation: + o.copyMatchingRows(retrieved) + case []*H3Aggregation: + o.copyMatchingRows(retrieved...) + case H3AggregationSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a H3Aggregation or a slice of H3Aggregation + // then run the AfterDeleteHooks on the slice + _, err = H3Aggregations.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o H3AggregationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals H3AggregationSetter) error { + if len(o) == 0 { + return nil + } + + _, err := H3Aggregations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o H3AggregationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := H3Aggregations.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o H3AggregationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := H3Aggregations.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// Organization starts a query for related objects on organization +func (o *H3Aggregation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os H3AggregationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkOrganizationID = append(pkOrganizationID, o.OrganizationID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkOrganizationID), "integer[]")), + )) + + return Organizations.Query(append(mods, + sm.Where(psql.Group(Organizations.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +func attachH3AggregationOrganization0(ctx context.Context, exec bob.Executor, count int, h3Aggregation0 *H3Aggregation, organization1 *Organization) (*H3Aggregation, error) { + setter := &H3AggregationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := h3Aggregation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachH3AggregationOrganization0: %w", err) + } + + return h3Aggregation0, nil +} + +func (h3Aggregation0 *H3Aggregation) InsertOrganization(ctx context.Context, exec bob.Executor, related *OrganizationSetter) error { + var err error + + organization1, err := Organizations.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachH3AggregationOrganization0(ctx, exec, 1, h3Aggregation0, organization1) + if err != nil { + return err + } + + h3Aggregation0.R.Organization = organization1 + + organization1.R.H3Aggregations = append(organization1.R.H3Aggregations, h3Aggregation0) + + return nil +} + +func (h3Aggregation0 *H3Aggregation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachH3AggregationOrganization0(ctx, exec, 1, h3Aggregation0, organization1) + if err != nil { + return err + } + + h3Aggregation0.R.Organization = organization1 + + organization1.R.H3Aggregations = append(organization1.R.H3Aggregations, h3Aggregation0) + + return nil +} + +type h3AggregationWhere[Q psql.Filterable] struct { + ID psql.WhereMod[Q, int32] + Cell psql.WhereMod[Q, string] + Resolution psql.WhereMod[Q, int32] + Count psql.WhereMod[Q, int32] + Type psql.WhereMod[Q, enums.H3aggregationtype] + OrganizationID psql.WhereMod[Q, int32] +} + +func (h3AggregationWhere[Q]) AliasedAs(alias string) h3AggregationWhere[Q] { + return buildH3AggregationWhere[Q](buildH3AggregationColumns(alias)) +} + +func buildH3AggregationWhere[Q psql.Filterable](cols h3AggregationColumns) h3AggregationWhere[Q] { + return h3AggregationWhere[Q]{ + ID: psql.Where[Q, int32](cols.ID), + Cell: psql.Where[Q, string](cols.Cell), + Resolution: psql.Where[Q, int32](cols.Resolution), + Count: psql.Where[Q, int32](cols.Count), + Type: psql.Where[Q, enums.H3aggregationtype](cols.Type), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *H3Aggregation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("h3Aggregation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.H3Aggregations = H3AggregationSlice{o} + } + return nil + default: + return fmt.Errorf("h3Aggregation has no relationship %q", name) + } +} + +type h3AggregationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildH3AggregationPreloader() h3AggregationPreloader { + return h3AggregationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: H3Aggregations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type h3AggregationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildH3AggregationThenLoader[Q orm.Loadable]() h3AggregationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return h3AggregationThenLoader[Q]{ + Organization: thenLoadBuilder[Q]( + "Organization", + func(ctx context.Context, exec bob.Executor, retrieved OrganizationLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadOrganization(ctx, exec, mods...) + }, + ), + } +} + +// LoadOrganization loads the h3Aggregation's Organization into the .R struct +func (o *H3Aggregation) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Organization = nil + + related, err := o.Organization(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.H3Aggregations = H3AggregationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the h3Aggregation's Organization into the .R struct +func (os H3AggregationSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + organizations, err := os.Organization(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range organizations { + + if !(o.OrganizationID == rel.ID) { + continue + } + + rel.R.H3Aggregations = append(rel.R.H3Aggregations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type h3AggregationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j h3AggregationJoins[Q]) aliasedAs(alias string) h3AggregationJoins[Q] { + return buildH3AggregationJoins[Q](buildH3AggregationColumns(alias), j.typ) +} + +func buildH3AggregationJoins[Q dialect.Joinable](cols h3AggregationColumns, typ string) h3AggregationJoins[Q] { + return h3AggregationJoins[Q]{ + typ: typ, + Organization: modAs[Q, organizationColumns]{ + c: Organizations.Columns, + f: func(to organizationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On( + to.ID.EQ(cols.OrganizationID), + )) + } + + return mods + }, + }, + } +} diff --git a/models/organization.bob.go b/models/organization.bob.go index 6e4e255f..7d9ca25f 100644 --- a/models/organization.bob.go +++ b/models/organization.bob.go @@ -74,6 +74,7 @@ type organizationR struct { FSTreatmentareas FSTreatmentareaSlice // fs_treatmentarea.fs_treatmentarea_organization_id_fkey FSZones FSZoneSlice // fs_zones.fs_zones_organization_id_fkey FSZones2s FSZones2Slice // fs_zones2.fs_zones2_organization_id_fkey + H3Aggregations H3AggregationSlice // h3_aggregation.h3_aggregation_organization_id_fkey HistoryContainerrelates HistoryContainerrelateSlice // history_containerrelate.history_containerrelate_organization_id_fkey HistoryFieldscoutinglogs HistoryFieldscoutinglogSlice // history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey HistoryHabitatrelates HistoryHabitatrelateSlice // history_habitatrelate.history_habitatrelate_organization_id_fkey @@ -1166,6 +1167,30 @@ func (os OrganizationSlice) FSZones2s(mods ...bob.Mod[*dialect.SelectQuery]) FSZ )...) } +// H3Aggregations starts a query for related objects on h3_aggregation +func (o *Organization) H3Aggregations(mods ...bob.Mod[*dialect.SelectQuery]) H3AggregationsQuery { + return H3Aggregations.Query(append(mods, + sm.Where(H3Aggregations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) H3Aggregations(mods ...bob.Mod[*dialect.SelectQuery]) H3AggregationsQuery { + pkID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkID = append(pkID, o.ID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), + )) + + return H3Aggregations.Query(append(mods, + sm.Where(psql.Group(H3Aggregations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // HistoryContainerrelates starts a query for related objects on history_containerrelate func (o *Organization) HistoryContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryContainerrelatesQuery { return HistoryContainerrelates.Query(append(mods, @@ -3742,6 +3767,74 @@ func (organization0 *Organization) AttachFSZones2s(ctx context.Context, exec bob return nil } +func insertOrganizationH3Aggregations0(ctx context.Context, exec bob.Executor, h3Aggregations1 []*H3AggregationSetter, organization0 *Organization) (H3AggregationSlice, error) { + for i := range h3Aggregations1 { + h3Aggregations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := H3Aggregations.Insert(bob.ToMods(h3Aggregations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationH3Aggregations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationH3Aggregations0(ctx context.Context, exec bob.Executor, count int, h3Aggregations1 H3AggregationSlice, organization0 *Organization) (H3AggregationSlice, error) { + setter := &H3AggregationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := h3Aggregations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationH3Aggregations0: %w", err) + } + + return h3Aggregations1, nil +} + +func (organization0 *Organization) InsertH3Aggregations(ctx context.Context, exec bob.Executor, related ...*H3AggregationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + h3Aggregations1, err := insertOrganizationH3Aggregations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.H3Aggregations = append(organization0.R.H3Aggregations, h3Aggregations1...) + + for _, rel := range h3Aggregations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachH3Aggregations(ctx context.Context, exec bob.Executor, related ...*H3Aggregation) error { + if len(related) == 0 { + return nil + } + + var err error + h3Aggregations1 := H3AggregationSlice(related) + + _, err = attachOrganizationH3Aggregations0(ctx, exec, len(related), h3Aggregations1, organization0) + if err != nil { + return err + } + + organization0.R.H3Aggregations = append(organization0.R.H3Aggregations, h3Aggregations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + func insertOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Executor, historyContainerrelates1 []*HistoryContainerrelateSetter, organization0 *Organization) (HistoryContainerrelateSlice, error) { for i := range historyContainerrelates1 { historyContainerrelates1[i].OrganizationID = omit.From(organization0.ID) @@ -6060,6 +6153,20 @@ func (o *Organization) Preload(name string, retrieved any) error { o.R.FSZones2s = rels + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "H3Aggregations": + rels, ok := retrieved.(H3AggregationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.H3Aggregations = rels + for _, rel := range rels { if rel != nil { rel.R.Organization = o @@ -6498,6 +6605,7 @@ type organizationThenLoader[Q orm.Loadable] struct { FSTreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FSZones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FSZones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + H3Aggregations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] HistoryContainerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] HistoryFieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] HistoryHabitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] @@ -6613,6 +6721,9 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { type FSZones2sLoadInterface interface { LoadFSZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } + type H3AggregationsLoadInterface interface { + LoadH3Aggregations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type HistoryContainerrelatesLoadInterface interface { LoadHistoryContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -6867,6 +6978,12 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { return retrieved.LoadFSZones2s(ctx, exec, mods...) }, ), + H3Aggregations: thenLoadBuilder[Q]( + "H3Aggregations", + func(ctx context.Context, exec bob.Executor, retrieved H3AggregationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadH3Aggregations(ctx, exec, mods...) + }, + ), HistoryContainerrelates: thenLoadBuilder[Q]( "HistoryContainerrelates", func(ctx context.Context, exec bob.Executor, retrieved HistoryContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -8746,6 +8863,67 @@ func (os OrganizationSlice) LoadFSZones2s(ctx context.Context, exec bob.Executor return nil } +// LoadH3Aggregations loads the organization's H3Aggregations into the .R struct +func (o *Organization) LoadH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.H3Aggregations = nil + + related, err := o.H3Aggregations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.H3Aggregations = related + return nil +} + +// LoadH3Aggregations loads the organization's H3Aggregations into the .R struct +func (os OrganizationSlice) LoadH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + h3Aggregations, err := os.H3Aggregations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.H3Aggregations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range h3Aggregations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.H3Aggregations = append(o.R.H3Aggregations, rel) + } + } + + return nil +} + // LoadHistoryContainerrelates loads the organization's HistoryContainerrelates into the .R struct func (o *Organization) LoadHistoryContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -10487,6 +10665,7 @@ type organizationJoins[Q dialect.Joinable] struct { FSTreatmentareas modAs[Q, fsTreatmentareaColumns] FSZones modAs[Q, fsZoneColumns] FSZones2s modAs[Q, fsZones2Columns] + H3Aggregations modAs[Q, h3AggregationColumns] HistoryContainerrelates modAs[Q, historyContainerrelateColumns] HistoryFieldscoutinglogs modAs[Q, historyFieldscoutinglogColumns] HistoryHabitatrelates modAs[Q, historyHabitatrelateColumns] @@ -10916,6 +11095,20 @@ func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ st return mods }, }, + H3Aggregations: modAs[Q, h3AggregationColumns]{ + c: H3Aggregations.Columns, + f: func(to h3AggregationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, H3Aggregations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, HistoryContainerrelates: modAs[Q, historyContainerrelateColumns]{ c: HistoryContainerrelates.Columns, f: func(to historyContainerrelateColumns) bob.Mod[Q] { diff --git a/models/raster_columns.bob.go b/models/raster_columns.bob.go new file mode 100644 index 00000000..fb7f2649 --- /dev/null +++ b/models/raster_columns.bob.go @@ -0,0 +1,171 @@ +// 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 models + +import ( + "context" + + "github.com/aarondl/opt/null" + "github.com/lib/pq" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/expr" +) + +// RasterColumn is an object representing the database table. +type RasterColumn struct { + RTableCatalog null.Val[string] `db:"r_table_catalog" ` + RTableSchema null.Val[string] `db:"r_table_schema" ` + RTableName null.Val[string] `db:"r_table_name" ` + RRasterColumn null.Val[string] `db:"r_raster_column" ` + Srid null.Val[int32] `db:"srid" ` + ScaleX null.Val[float64] `db:"scale_x" ` + ScaleY null.Val[float64] `db:"scale_y" ` + BlocksizeX null.Val[int32] `db:"blocksize_x" ` + BlocksizeY null.Val[int32] `db:"blocksize_y" ` + SameAlignment null.Val[bool] `db:"same_alignment" ` + RegularBlocking null.Val[bool] `db:"regular_blocking" ` + NumBands null.Val[int32] `db:"num_bands" ` + PixelTypes null.Val[pq.StringArray] `db:"pixel_types" ` + NodataValues null.Val[pq.Float64Array] `db:"nodata_values" ` + OutDB null.Val[pq.BoolArray] `db:"out_db" ` + Extent null.Val[string] `db:"extent" ` + SpatialIndex null.Val[bool] `db:"spatial_index" ` +} + +// RasterColumnSlice is an alias for a slice of pointers to RasterColumn. +// This should almost always be used instead of []*RasterColumn. +type RasterColumnSlice []*RasterColumn + +// RasterColumns contains methods to work with the raster_columns view +var RasterColumns = psql.NewViewx[*RasterColumn, RasterColumnSlice]("", "raster_columns", buildRasterColumnColumns("raster_columns")) + +// RasterColumnsQuery is a query on the raster_columns view +type RasterColumnsQuery = *psql.ViewQuery[*RasterColumn, RasterColumnSlice] + +func buildRasterColumnColumns(alias string) rasterColumnColumns { + return rasterColumnColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "r_table_catalog", "r_table_schema", "r_table_name", "r_raster_column", "srid", "scale_x", "scale_y", "blocksize_x", "blocksize_y", "same_alignment", "regular_blocking", "num_bands", "pixel_types", "nodata_values", "out_db", "extent", "spatial_index", + ).WithParent("raster_columns"), + tableAlias: alias, + RTableCatalog: psql.Quote(alias, "r_table_catalog"), + RTableSchema: psql.Quote(alias, "r_table_schema"), + RTableName: psql.Quote(alias, "r_table_name"), + RRasterColumn: psql.Quote(alias, "r_raster_column"), + Srid: psql.Quote(alias, "srid"), + ScaleX: psql.Quote(alias, "scale_x"), + ScaleY: psql.Quote(alias, "scale_y"), + BlocksizeX: psql.Quote(alias, "blocksize_x"), + BlocksizeY: psql.Quote(alias, "blocksize_y"), + SameAlignment: psql.Quote(alias, "same_alignment"), + RegularBlocking: psql.Quote(alias, "regular_blocking"), + NumBands: psql.Quote(alias, "num_bands"), + PixelTypes: psql.Quote(alias, "pixel_types"), + NodataValues: psql.Quote(alias, "nodata_values"), + OutDB: psql.Quote(alias, "out_db"), + Extent: psql.Quote(alias, "extent"), + SpatialIndex: psql.Quote(alias, "spatial_index"), + } +} + +type rasterColumnColumns struct { + expr.ColumnsExpr + tableAlias string + RTableCatalog psql.Expression + RTableSchema psql.Expression + RTableName psql.Expression + RRasterColumn psql.Expression + Srid psql.Expression + ScaleX psql.Expression + ScaleY psql.Expression + BlocksizeX psql.Expression + BlocksizeY psql.Expression + SameAlignment psql.Expression + RegularBlocking psql.Expression + NumBands psql.Expression + PixelTypes psql.Expression + NodataValues psql.Expression + OutDB psql.Expression + Extent psql.Expression + SpatialIndex psql.Expression +} + +func (c rasterColumnColumns) Alias() string { + return c.tableAlias +} + +func (rasterColumnColumns) AliasedAs(alias string) rasterColumnColumns { + return buildRasterColumnColumns(alias) +} + +// AfterQueryHook is called after RasterColumn is retrieved from the database +func (o *RasterColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = RasterColumns.AfterSelectHooks.RunHooks(ctx, exec, RasterColumnSlice{o}) + } + + return err +} + +// AfterQueryHook is called after RasterColumnSlice is retrieved from the database +func (o RasterColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = RasterColumns.AfterSelectHooks.RunHooks(ctx, exec, o) + } + + return err +} + +type rasterColumnWhere[Q psql.Filterable] struct { + RTableCatalog psql.WhereNullMod[Q, string] + RTableSchema psql.WhereNullMod[Q, string] + RTableName psql.WhereNullMod[Q, string] + RRasterColumn psql.WhereNullMod[Q, string] + Srid psql.WhereNullMod[Q, int32] + ScaleX psql.WhereNullMod[Q, float64] + ScaleY psql.WhereNullMod[Q, float64] + BlocksizeX psql.WhereNullMod[Q, int32] + BlocksizeY psql.WhereNullMod[Q, int32] + SameAlignment psql.WhereNullMod[Q, bool] + RegularBlocking psql.WhereNullMod[Q, bool] + NumBands psql.WhereNullMod[Q, int32] + PixelTypes psql.WhereNullMod[Q, pq.StringArray] + NodataValues psql.WhereNullMod[Q, pq.Float64Array] + OutDB psql.WhereNullMod[Q, pq.BoolArray] + Extent psql.WhereNullMod[Q, string] + SpatialIndex psql.WhereNullMod[Q, bool] +} + +func (rasterColumnWhere[Q]) AliasedAs(alias string) rasterColumnWhere[Q] { + return buildRasterColumnWhere[Q](buildRasterColumnColumns(alias)) +} + +func buildRasterColumnWhere[Q psql.Filterable](cols rasterColumnColumns) rasterColumnWhere[Q] { + return rasterColumnWhere[Q]{ + RTableCatalog: psql.WhereNull[Q, string](cols.RTableCatalog), + RTableSchema: psql.WhereNull[Q, string](cols.RTableSchema), + RTableName: psql.WhereNull[Q, string](cols.RTableName), + RRasterColumn: psql.WhereNull[Q, string](cols.RRasterColumn), + Srid: psql.WhereNull[Q, int32](cols.Srid), + ScaleX: psql.WhereNull[Q, float64](cols.ScaleX), + ScaleY: psql.WhereNull[Q, float64](cols.ScaleY), + BlocksizeX: psql.WhereNull[Q, int32](cols.BlocksizeX), + BlocksizeY: psql.WhereNull[Q, int32](cols.BlocksizeY), + SameAlignment: psql.WhereNull[Q, bool](cols.SameAlignment), + RegularBlocking: psql.WhereNull[Q, bool](cols.RegularBlocking), + NumBands: psql.WhereNull[Q, int32](cols.NumBands), + PixelTypes: psql.WhereNull[Q, pq.StringArray](cols.PixelTypes), + NodataValues: psql.WhereNull[Q, pq.Float64Array](cols.NodataValues), + OutDB: psql.WhereNull[Q, pq.BoolArray](cols.OutDB), + Extent: psql.WhereNull[Q, string](cols.Extent), + SpatialIndex: psql.WhereNull[Q, bool](cols.SpatialIndex), + } +} diff --git a/models/raster_overviews.bob.go b/models/raster_overviews.bob.go new file mode 100644 index 00000000..cfacc9c9 --- /dev/null +++ b/models/raster_overviews.bob.go @@ -0,0 +1,130 @@ +// 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 models + +import ( + "context" + + "github.com/aarondl/opt/null" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/expr" +) + +// RasterOverview is an object representing the database table. +type RasterOverview struct { + OTableCatalog null.Val[string] `db:"o_table_catalog" ` + OTableSchema null.Val[string] `db:"o_table_schema" ` + OTableName null.Val[string] `db:"o_table_name" ` + ORasterColumn null.Val[string] `db:"o_raster_column" ` + RTableCatalog null.Val[string] `db:"r_table_catalog" ` + RTableSchema null.Val[string] `db:"r_table_schema" ` + RTableName null.Val[string] `db:"r_table_name" ` + RRasterColumn null.Val[string] `db:"r_raster_column" ` + OverviewFactor null.Val[int32] `db:"overview_factor" ` +} + +// RasterOverviewSlice is an alias for a slice of pointers to RasterOverview. +// This should almost always be used instead of []*RasterOverview. +type RasterOverviewSlice []*RasterOverview + +// RasterOverviews contains methods to work with the raster_overviews view +var RasterOverviews = psql.NewViewx[*RasterOverview, RasterOverviewSlice]("", "raster_overviews", buildRasterOverviewColumns("raster_overviews")) + +// RasterOverviewsQuery is a query on the raster_overviews view +type RasterOverviewsQuery = *psql.ViewQuery[*RasterOverview, RasterOverviewSlice] + +func buildRasterOverviewColumns(alias string) rasterOverviewColumns { + return rasterOverviewColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "o_table_catalog", "o_table_schema", "o_table_name", "o_raster_column", "r_table_catalog", "r_table_schema", "r_table_name", "r_raster_column", "overview_factor", + ).WithParent("raster_overviews"), + tableAlias: alias, + OTableCatalog: psql.Quote(alias, "o_table_catalog"), + OTableSchema: psql.Quote(alias, "o_table_schema"), + OTableName: psql.Quote(alias, "o_table_name"), + ORasterColumn: psql.Quote(alias, "o_raster_column"), + RTableCatalog: psql.Quote(alias, "r_table_catalog"), + RTableSchema: psql.Quote(alias, "r_table_schema"), + RTableName: psql.Quote(alias, "r_table_name"), + RRasterColumn: psql.Quote(alias, "r_raster_column"), + OverviewFactor: psql.Quote(alias, "overview_factor"), + } +} + +type rasterOverviewColumns struct { + expr.ColumnsExpr + tableAlias string + OTableCatalog psql.Expression + OTableSchema psql.Expression + OTableName psql.Expression + ORasterColumn psql.Expression + RTableCatalog psql.Expression + RTableSchema psql.Expression + RTableName psql.Expression + RRasterColumn psql.Expression + OverviewFactor psql.Expression +} + +func (c rasterOverviewColumns) Alias() string { + return c.tableAlias +} + +func (rasterOverviewColumns) AliasedAs(alias string) rasterOverviewColumns { + return buildRasterOverviewColumns(alias) +} + +// AfterQueryHook is called after RasterOverview is retrieved from the database +func (o *RasterOverview) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = RasterOverviews.AfterSelectHooks.RunHooks(ctx, exec, RasterOverviewSlice{o}) + } + + return err +} + +// AfterQueryHook is called after RasterOverviewSlice is retrieved from the database +func (o RasterOverviewSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = RasterOverviews.AfterSelectHooks.RunHooks(ctx, exec, o) + } + + return err +} + +type rasterOverviewWhere[Q psql.Filterable] struct { + OTableCatalog psql.WhereNullMod[Q, string] + OTableSchema psql.WhereNullMod[Q, string] + OTableName psql.WhereNullMod[Q, string] + ORasterColumn psql.WhereNullMod[Q, string] + RTableCatalog psql.WhereNullMod[Q, string] + RTableSchema psql.WhereNullMod[Q, string] + RTableName psql.WhereNullMod[Q, string] + RRasterColumn psql.WhereNullMod[Q, string] + OverviewFactor psql.WhereNullMod[Q, int32] +} + +func (rasterOverviewWhere[Q]) AliasedAs(alias string) rasterOverviewWhere[Q] { + return buildRasterOverviewWhere[Q](buildRasterOverviewColumns(alias)) +} + +func buildRasterOverviewWhere[Q psql.Filterable](cols rasterOverviewColumns) rasterOverviewWhere[Q] { + return rasterOverviewWhere[Q]{ + OTableCatalog: psql.WhereNull[Q, string](cols.OTableCatalog), + OTableSchema: psql.WhereNull[Q, string](cols.OTableSchema), + OTableName: psql.WhereNull[Q, string](cols.OTableName), + ORasterColumn: psql.WhereNull[Q, string](cols.ORasterColumn), + RTableCatalog: psql.WhereNull[Q, string](cols.RTableCatalog), + RTableSchema: psql.WhereNull[Q, string](cols.RTableSchema), + RTableName: psql.WhereNull[Q, string](cols.RTableName), + RRasterColumn: psql.WhereNull[Q, string](cols.RRasterColumn), + OverviewFactor: psql.WhereNull[Q, int32](cols.OverviewFactor), + } +} diff --git a/models/spatial_ref_sys.bob.go b/models/spatial_ref_sys.bob.go new file mode 100644 index 00000000..f8e624a7 --- /dev/null +++ b/models/spatial_ref_sys.bob.go @@ -0,0 +1,450 @@ +// 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 models + +import ( + "context" + "io" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/dialect/psql/dialect" + "github.com/stephenafamo/bob/dialect/psql/dm" + "github.com/stephenafamo/bob/dialect/psql/sm" + "github.com/stephenafamo/bob/dialect/psql/um" + "github.com/stephenafamo/bob/expr" +) + +// SpatialRefSy is an object representing the database table. +type SpatialRefSy struct { + Srid int32 `db:"srid,pk" ` + AuthName null.Val[string] `db:"auth_name" ` + AuthSrid null.Val[int32] `db:"auth_srid" ` + Srtext null.Val[string] `db:"srtext" ` + Proj4text null.Val[string] `db:"proj4text" ` +} + +// SpatialRefSySlice is an alias for a slice of pointers to SpatialRefSy. +// This should almost always be used instead of []*SpatialRefSy. +type SpatialRefSySlice []*SpatialRefSy + +// SpatialRefSys contains methods to work with the spatial_ref_sys table +var SpatialRefSys = psql.NewTablex[*SpatialRefSy, SpatialRefSySlice, *SpatialRefSySetter]("", "spatial_ref_sys", buildSpatialRefSyColumns("spatial_ref_sys")) + +// SpatialRefSysQuery is a query on the spatial_ref_sys table +type SpatialRefSysQuery = *psql.ViewQuery[*SpatialRefSy, SpatialRefSySlice] + +func buildSpatialRefSyColumns(alias string) spatialRefSyColumns { + return spatialRefSyColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "srid", "auth_name", "auth_srid", "srtext", "proj4text", + ).WithParent("spatial_ref_sys"), + tableAlias: alias, + Srid: psql.Quote(alias, "srid"), + AuthName: psql.Quote(alias, "auth_name"), + AuthSrid: psql.Quote(alias, "auth_srid"), + Srtext: psql.Quote(alias, "srtext"), + Proj4text: psql.Quote(alias, "proj4text"), + } +} + +type spatialRefSyColumns struct { + expr.ColumnsExpr + tableAlias string + Srid psql.Expression + AuthName psql.Expression + AuthSrid psql.Expression + Srtext psql.Expression + Proj4text psql.Expression +} + +func (c spatialRefSyColumns) Alias() string { + return c.tableAlias +} + +func (spatialRefSyColumns) AliasedAs(alias string) spatialRefSyColumns { + return buildSpatialRefSyColumns(alias) +} + +// SpatialRefSySetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type SpatialRefSySetter struct { + Srid omit.Val[int32] `db:"srid,pk" ` + AuthName omitnull.Val[string] `db:"auth_name" ` + AuthSrid omitnull.Val[int32] `db:"auth_srid" ` + Srtext omitnull.Val[string] `db:"srtext" ` + Proj4text omitnull.Val[string] `db:"proj4text" ` +} + +func (s SpatialRefSySetter) SetColumns() []string { + vals := make([]string, 0, 5) + if s.Srid.IsValue() { + vals = append(vals, "srid") + } + if !s.AuthName.IsUnset() { + vals = append(vals, "auth_name") + } + if !s.AuthSrid.IsUnset() { + vals = append(vals, "auth_srid") + } + if !s.Srtext.IsUnset() { + vals = append(vals, "srtext") + } + if !s.Proj4text.IsUnset() { + vals = append(vals, "proj4text") + } + return vals +} + +func (s SpatialRefSySetter) Overwrite(t *SpatialRefSy) { + if s.Srid.IsValue() { + t.Srid = s.Srid.MustGet() + } + if !s.AuthName.IsUnset() { + t.AuthName = s.AuthName.MustGetNull() + } + if !s.AuthSrid.IsUnset() { + t.AuthSrid = s.AuthSrid.MustGetNull() + } + if !s.Srtext.IsUnset() { + t.Srtext = s.Srtext.MustGetNull() + } + if !s.Proj4text.IsUnset() { + t.Proj4text = s.Proj4text.MustGetNull() + } +} + +func (s *SpatialRefSySetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return SpatialRefSys.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 5) + if s.Srid.IsValue() { + vals[0] = psql.Arg(s.Srid.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.AuthName.IsUnset() { + vals[1] = psql.Arg(s.AuthName.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.AuthSrid.IsUnset() { + vals[2] = psql.Arg(s.AuthSrid.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Srtext.IsUnset() { + vals[3] = psql.Arg(s.Srtext.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Proj4text.IsUnset() { + vals[4] = psql.Arg(s.Proj4text.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s SpatialRefSySetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s SpatialRefSySetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 5) + + if s.Srid.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srid")...), + psql.Arg(s.Srid), + }}) + } + + if !s.AuthName.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "auth_name")...), + psql.Arg(s.AuthName), + }}) + } + + if !s.AuthSrid.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "auth_srid")...), + psql.Arg(s.AuthSrid), + }}) + } + + if !s.Srtext.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "srtext")...), + psql.Arg(s.Srtext), + }}) + } + + if !s.Proj4text.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "proj4text")...), + psql.Arg(s.Proj4text), + }}) + } + + return exprs +} + +// FindSpatialRefSy retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindSpatialRefSy(ctx context.Context, exec bob.Executor, SridPK int32, cols ...string) (*SpatialRefSy, error) { + if len(cols) == 0 { + return SpatialRefSys.Query( + sm.Where(SpatialRefSys.Columns.Srid.EQ(psql.Arg(SridPK))), + ).One(ctx, exec) + } + + return SpatialRefSys.Query( + sm.Where(SpatialRefSys.Columns.Srid.EQ(psql.Arg(SridPK))), + sm.Columns(SpatialRefSys.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// SpatialRefSyExists checks the presence of a single record by primary key +func SpatialRefSyExists(ctx context.Context, exec bob.Executor, SridPK int32) (bool, error) { + return SpatialRefSys.Query( + sm.Where(SpatialRefSys.Columns.Srid.EQ(psql.Arg(SridPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after SpatialRefSy is retrieved from the database +func (o *SpatialRefSy) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = SpatialRefSys.AfterSelectHooks.RunHooks(ctx, exec, SpatialRefSySlice{o}) + case bob.QueryTypeInsert: + ctx, err = SpatialRefSys.AfterInsertHooks.RunHooks(ctx, exec, SpatialRefSySlice{o}) + case bob.QueryTypeUpdate: + ctx, err = SpatialRefSys.AfterUpdateHooks.RunHooks(ctx, exec, SpatialRefSySlice{o}) + case bob.QueryTypeDelete: + ctx, err = SpatialRefSys.AfterDeleteHooks.RunHooks(ctx, exec, SpatialRefSySlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the SpatialRefSy +func (o *SpatialRefSy) primaryKeyVals() bob.Expression { + return psql.Arg(o.Srid) +} + +func (o *SpatialRefSy) pkEQ() dialect.Expression { + return psql.Quote("spatial_ref_sys", "srid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the SpatialRefSy +func (o *SpatialRefSy) Update(ctx context.Context, exec bob.Executor, s *SpatialRefSySetter) error { + v, err := SpatialRefSys.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec) + if err != nil { + return err + } + + *o = *v + + return nil +} + +// Delete deletes a single SpatialRefSy record with an executor +func (o *SpatialRefSy) Delete(ctx context.Context, exec bob.Executor) error { + _, err := SpatialRefSys.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the SpatialRefSy using the executor +func (o *SpatialRefSy) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := SpatialRefSys.Query( + sm.Where(SpatialRefSys.Columns.Srid.EQ(psql.Arg(o.Srid))), + ).One(ctx, exec) + if err != nil { + return err + } + + *o = *o2 + + return nil +} + +// AfterQueryHook is called after SpatialRefSySlice is retrieved from the database +func (o SpatialRefSySlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = SpatialRefSys.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = SpatialRefSys.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = SpatialRefSys.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = SpatialRefSys.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o SpatialRefSySlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("spatial_ref_sys", "srid").In(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + pkPairs := make([]bob.Expression, len(o)) + for i, row := range o { + pkPairs[i] = row.primaryKeyVals() + } + return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "") + })) +} + +// copyMatchingRows finds models in the given slice that have the same primary key +// then it first copies the existing relationships from the old model to the new model +// and then replaces the old model in the slice with the new model +func (o SpatialRefSySlice) copyMatchingRows(from ...*SpatialRefSy) { + for i, old := range o { + for _, new := range from { + if new.Srid != old.Srid { + continue + } + + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o SpatialRefSySlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return SpatialRefSys.BeforeUpdateHooks.RunHooks(ctx, exec, o) + }) + + q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { + var err error + switch retrieved := retrieved.(type) { + case *SpatialRefSy: + o.copyMatchingRows(retrieved) + case []*SpatialRefSy: + o.copyMatchingRows(retrieved...) + case SpatialRefSySlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a SpatialRefSy or a slice of SpatialRefSy + // then run the AfterUpdateHooks on the slice + _, err = SpatialRefSys.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o SpatialRefSySlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] { + return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return SpatialRefSys.BeforeDeleteHooks.RunHooks(ctx, exec, o) + }) + + q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { + var err error + switch retrieved := retrieved.(type) { + case *SpatialRefSy: + o.copyMatchingRows(retrieved) + case []*SpatialRefSy: + o.copyMatchingRows(retrieved...) + case SpatialRefSySlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a SpatialRefSy or a slice of SpatialRefSy + // then run the AfterDeleteHooks on the slice + _, err = SpatialRefSys.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o SpatialRefSySlice) UpdateAll(ctx context.Context, exec bob.Executor, vals SpatialRefSySetter) error { + if len(o) == 0 { + return nil + } + + _, err := SpatialRefSys.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o SpatialRefSySlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := SpatialRefSys.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o SpatialRefSySlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := SpatialRefSys.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +type spatialRefSyWhere[Q psql.Filterable] struct { + Srid psql.WhereMod[Q, int32] + AuthName psql.WhereNullMod[Q, string] + AuthSrid psql.WhereNullMod[Q, int32] + Srtext psql.WhereNullMod[Q, string] + Proj4text psql.WhereNullMod[Q, string] +} + +func (spatialRefSyWhere[Q]) AliasedAs(alias string) spatialRefSyWhere[Q] { + return buildSpatialRefSyWhere[Q](buildSpatialRefSyColumns(alias)) +} + +func buildSpatialRefSyWhere[Q psql.Filterable](cols spatialRefSyColumns) spatialRefSyWhere[Q] { + return spatialRefSyWhere[Q]{ + Srid: psql.Where[Q, int32](cols.Srid), + AuthName: psql.WhereNull[Q, string](cols.AuthName), + AuthSrid: psql.WhereNull[Q, int32](cols.AuthSrid), + Srtext: psql.WhereNull[Q, string](cols.Srtext), + Proj4text: psql.WhereNull[Q, string](cols.Proj4text), + } +}